Git working with Code

once you have git repository ready as explained in previous tutorial. its tim to work with file. currently the git folder is empty.

the process:

  1. create a file and save in git project folder
  2. add file to staging env ( new file –> staging env –> git repo)
  3. commit file into git repository from staging env
  4. create branch to manipulate on file for example bug fixes, patch release or development.
  5. merge the branch code to master branch

1. Create File

lets create one file using code editor.

 I prefer visual code editor and create as below

Please make sure to save this file inside same folder where we initialize git.

once done, check with below command if file is listed in project folder.

check the git status by:

you will see following output:

Now the git understand there is one new file which is in untrack status means not been added to staging yet

2. Add New File to staging:

before moving to git repo, we need to move first the file to staging env and then to git repo

use command to move to staging:

it will add all untracked file to staging environment and make ready for commit.

3. Commit The File:


once executed command, it will look like this:

check with GIT log command as shown below:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top