Version Control using Git and Github (Part 1)

  1. Untracked by Git: Untracked files are those that have been created within your repository’s working directory but have not yet been added to the repository’s tracking index using the git add command.
  2. Tracked by Git: Tracked files are that which exist in the Git’s tracking index.
  1. Working Directory — This is the directory in which the project or file is residing. It may or may not be tracked by Git.
  2. Staging Area — When in working directory, the files to be tracked by Git is selected. Staging area is the playground where you group, add and organize the files to be committed to Git for tracking their versions.
  3. Git Directory — After the files to be committed are grouped and ready in the staging area, we can commit these files. Thus we commit this group of files along with a commit message explaining what is the commit about. When committed, a snapshot of the files in the commit is recorded by Git. The information related to this commit is stored in the Git directory. Thus, Git directory is the database where metadata about project files’ history will be tracked.
$ sudo apt-get install git (or)
$ sudo apt-get install git-all
$ git --version
$ git init
$ git add <filename> — to add a particular file in the working                         
directory to the staging area
(or)
$ git add . - to add all the files in the working directory to the
staging area
$ git status
$ git commit -m "Commit Message"
$ git log
$ git reset <hash>
$ git reflog
$ git revert HEAD
$ git revert <HASH>
$ git rm <Filename>

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store