Open In App
Related Articles

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

Improve Article
Save Article
Like Article

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. 


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: We use various commands while working with git, here’s a detailed explanation of the two commands we are often confused with i.e. “git add” and “git add -A” 

A. Git add- Command

“git add” places the modified version of the file from the working directory and places it into the staging area.


git add file_name_with_extension


git add

B. Git Add -a  Command

“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 between 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 :


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.

Let us finally discuss the differences between git add and git add -a

Git add <filename> add any particular file only. Git add sends all files from the untracked area to the stage area.
Git add is more like to be used in big projects where small changes are used to be made. Git add -a, all the untracked files to the staging area.
“Git add” is comparatively less handy. “Git add -a” is more healthy.
Git add doesn’t deletion adds stage changes. Git add stages changes including modification or code deletion,
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 31 May, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials