Git Basics: How to stage your changes using Git add command?

In the last article, we covered "Git Fetch and Git Pull". Today we are going to discuss another topic on the Git Basics tutorial series i.e. "How to stage your changes to Git repository", which you will find useful while working in Git.


Let's continue learning about the command "git add" today with the parameters that you need to know. Stay tuned to read more and more posts on Git basic topics.


Stage your changes to Git (


The git add and git commit commands compose the fundamental Git workflow. These are the two very basic commands that every Git user needs to learn, irrespective of the collaboration model that the team follows. These commands are used to commit new versions/changes of a project into the repository’s history.


First of all, you add/edit/delete your files in the working directory. When you’re ready to save, the git add command adds the changes in the working directory to the staging area. The staging area is a group of related changes into a single snapshot before actually committing it to the project history. When you are happy with the staged snapshot, you need to commit it to the actual project history with the command git commit, which we will discuss in the next post.


Here's the basic commands that you need to learn and remember to add changes to the staging area:


Stage all changes in current directory:

$ git add


Stage all changes in specified file:

$ git add <file>


Stage all changes in specified directory:

$ git add <directory>


Add modified contents in the working tree interactively:

$ git add -i


Was this post useful? If you came to this page by searching online about git basics, please have a look into my other blog posts. Subscribe to the RSS feed or the email newsletter to keep yourself updated.




If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter , Facebook , Google+ and LinkedIn . I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.


© 2008-2016 - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top