Git is the most popular version control system now a days specially in agile development. Its makes a developer’s life much easier. It is different from its compitators like SVN because it has functionality of Staging Area


Staging area provides the fexiblity to choose the content which you want to commit or say stores that snapshot permanently to your Git directory. Suppose you have 10 lines modified in a file so all changes are in Working directory. But you want to commit only 2 line changes.So will add only those two lines in staging area. When we run the git commit command, it will store changes which are in staging area only.

git add is the command use to moe the changes from working directory to staging area. There is one command git diff which shows the dfference between working directory and staging area. Also there is one flag git diff –staged which shows the difference between staging area and git repo(.git folder).

It is kind of tidious if we frequently add or remove data into/from staging area and check what is status of staging area right now, using above commands. So Git provides a simple or better way to interact with staging area so that we can easily add, remove and check the changes in staging area. One feature that I like personally is adding partial changes to staging area wherea as rest will be in working directory.
It is a flag -i provided in git add command to get into it. Example :
second

  1. status : It shows the status of staging area. What is in working directory along with its file name.
  2. update : To add all changes of files to staging area.
    update
  3. revert : To rollback the changes from staging area to working directory. it is just opposite to “update”.
    revert
  4. add untracked : To track newly(untracked files) added files in git.

    untracked

  5. patch : It provides the functionality to add changes hunk by hunk. Or we can manually decide what changes we want to move to staging area. Example :

    patch
    partial_patch1

  6. diff : Shows the difference between staging area and git repo. Basically the changes which are in staging area.
    diff1

  7. quit : To quit from interactive mode.

Hope this will help you! Please provide your feedback below. 🙂