Git Add . (All)

git add . stages all changes in the current directory and everything below it — modified files, new files, and deleted files — in a single command. It’s the fastest way to prepare everything for a commit when you want the full working-directory state captured. This is the fourth post in this site’s Git command guide, following Git Add.

Basic Usage

Suppose you made changes to two files named file1.txt and file2.txt and you want to include both in your next commit. Navigate to the project directory in the terminal and execute:

git add .

This stages all changes in the repository. You can now review what’s staged by running:

git status

You should see that both file1.txt and file2.txt have been staged. Now commit the staged changes:

git commit -m "Added new feature to file1.txt"

The commit will include all changes.

git add . vs git add -A

In modern Git (2.x), git add . and git add -A behave identically when run from the root of the repository — both stage new files, modifications, and deletions across the entire working tree. The difference only matters if you run the command from a subdirectory: git add . stages changes relative to the current directory, while git add -A always stages the entire repository regardless of where you are.

When to Use git add . vs git add <file>

  • Use git add . when all your current changes belong together in one logical commit and you’re confident nothing is modified that shouldn’t be.
  • Use git add <file> (covered in Git Add) when you want to stage only a subset of your changes and leave others for a separate commit.
  • Always run git status before committing to confirm exactly what was staged — especially with git add ., which is easy to overuse.

See Also: This Site’s Git Command Guide

This post is part of a 13-part Git command guide on this site:

Conclusion

git add . is the fastest path from working changes to a staged snapshot, but it’s most useful when you’ve kept your changes focused. Once everything is staged, the next step is locking them in — covered in Git Commit.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.