How does git works

How does git works

Increase your technical knowledge through our FSH Infotech Blog section.

We add various blog categories that is related to IT technologies.

You can find more blogs added by our administrator by using the below link. Click here for more blogs


GitHub is an open-source version control system that tracks content such as files and directories.

What can we do using GitHub?

  • Keep every file tracked to understand easily what all changes are made in it.
  • Keeping track of files and collaborators.
  • When you messed up with the code and wanted to revert back to when it was working.

The basic workflow of GitHub

  • Modification of files in the working directory
  • Staging the files into the staging area
  • Committing and storing all the files in the git directory

github workflow

Working directory: Modified files, but untracked and not yet ready for commit.

Staging directory: Adding modified files to the staging environment means they are ready for commit.

Committed directory: Snapshots of files from the staging area are saved in the commit history.

Working with Git

To start with GitHub, here is the list of common commands you will use when working with Git:

  • git init -- initializes the git repository
  • git checkout -- checks out the git branch from a repository into your working directory
  • git add -- adds the changes you made in a file to a change set
  • git commit -- commits the changes you made from the working directory into the git repository

References

https://phoenixnap.com/kb/how-git-works

https://developer.ibm.com/tutorials/d-learn-workings-git/