Skip to content
Related Articles

Related Articles

Improve Article

Difference between “git add -A” and “git add”

  • Last Updated : 29 Jun, 2021
Geek Week

Overview :
Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. It is basically, software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. 

Features :
It is massively used by programmers who work on projects in a team for the following purpose.

  • Keep track of all files in a project.
  • Record changes done in project files.
  • Compare and analyze codes.
  • Restore previous versions.
  • Merge code from different systems of team members.

Working :
Here, we will discuss the working steps as follows.

Step-1 :
We use various command while working with git, here’s the detailed explanation of the two commands we are often confused with i.e. “git add” and “git add -A” 

Step-2 :
“git add” places the modified version of the file from the working directory and places it into the staging area.
Syntax –

git add file_name_with_extension

 Example –

git add

Step-3 :
“git add -A” stages all the changes. It is equivalent to “git add -all” or “git add . , git add -u” combined. Here, we will understand the difference in both of them as follows.

  • “git add .” stages new files and modifications, without deletions (on the current directory and its subdirectories).
  • “git add -u” stages modifications and deletion without new files.

Step-4 :
Command –
So, “git add -A” is a handy shortcut to both of those.

git add -A


git add -all


git add .
git add -u

Difference between “git add” and “git add -A” 

Implementation steps :
In short, we can say that “git add” is used to stage a specific file while “git add -A” stages all the modified files at once.

Step-1 :
In the following screenshot, changes are made in the five files.

Step-2 :
Now, to add a single file into the staging area, we use “git add file_name with the extension” as shown below.

Step-3 :
To add multiple files into the staging area at once, we use “git add -A” as shown below.

My Personal Notes arrow_drop_up
Recommended Articles
Page :