add * means add all files in the current directory, except for files whose name begin with a dot. This is your shell functionality and Git only ever receives a list of files.

add . has no special meaning in your shell, and thus Git adds the entire directory recursively, which is almost the same, but including files whose names begin with a dot.

Answer from Denis on Stack Overflow
🌐
Git
git-scm.com › docs › git-add
Git - git-add Documentation
This command can be performed multiple times before a commit. It only adds the content of the specified file(s) at the time the add command is run; if you want subsequent changes included in the next commit, then you must run git add again to add the new content to the index.
🌐
GitHub
github.com › git-guides › git-add
Git Guides - git add · GitHub
The git add command adds new or changed files in your working directory to the Git staging area.
Discussions

version control - git add * (asterisk) vs git add . (period) - Stack Overflow
I have a question about adding files in git. I have found multiple stackoverflow questions about the difference between git add . and git add -a, git add --all, git add -A, etc. But I've been unabl... More on stackoverflow.com
🌐 stackoverflow.com
What does the 'git add .' ('git add' single dot) command do? - Stack Overflow
I don't get what the Git command means, when adding files to the stage with the use of a period (or full stop, single dot): git add . What does this do? More on stackoverflow.com
🌐 stackoverflow.com
What's the difference between "git add *", "git add ." and "git add -A"?
git add * instructs your shell to expand the glob. Whatever the shell expands that to is passed to git add. This can have a variety of effects since git add accepts pathspecs, not filenames, and certain "magic" pathspecs have special behaviour. For instance, a pathspec that begins with :^ can be used to negate matches (e.g. git add file.* :^file.jpg could be used to add all filenames matching file.*, but not add file.jpg). If you must get the shell to do the globbing (described below are some ways in which you can avoid having the shell perform the globbing), you could consider using git add -- * instead. This won't avoid the "magic" pathspec issue, but it will avoid any issues with filenames that happen to have a leading hyphen (just imagine how annoying it would be to have a file named -A). git add . instructs Git to add and (on modern versions of Git) remove files from the index so that it matches the contents of the current directory, and recursively all subdirectories. git add -A is identical to git add . (edit: when run from the top directory) on modern versions of Git. As noted above, older versions of Git did not remove files from the index with git add ., but they did with git add -A. You missed one: git add '*'. This instructs Git to perform the globbing instead of your shell. This has two effects. First, it means that filenames that just happen to be "magic" pathspecs won't actually invoke their magic (i.e. if a file is named :^file.jpg it won't do that negation thing I described above). Second, the globbing behaves slightly differently from the shell: in particular, * and ? can match a directory separator, which means git add '*.txt' would actually add all files ending with .txt in the current directory and any descendent directory. More on reddit.com
🌐 r/git
20
37
December 4, 2020
What are 'git add' and 'git commit' doing and how are they different from each other?
git add tells git that it should track changes made to a particular file. Useful if you don't necessarily want to track all changes to all files in the index at every commit. git commit is like a save button. Up until that point all changes since the last commit are still just "staged" and not yet permanently written into the local git repo. This command tells git to permanently store changes made to the files you selected using git add as a node in the git tree. git commit -a is a shortcut for "save all changes to all known files in the index". It's the same as if you git add'ed all the files you're already tracking and then ran git commit. No new files will be tracked, so if something / someone writes junk like temporary files they won't get swept up into the repo. I understand how to use it but don't quite understand why it is necessary to use 'git add --> git commit --> git push', instead of just 'git commit --> git push'. It's just the way git is designed. At each commit you have to tell git "I want changes to these files to be tracked" (git add), "Save those changes to my local repo" (git commit), and "Send my changes to a remote repo" (git push). If all you want to do is track changes to the same files every time, that's what git commit -a is for. More on reddit.com
🌐 r/learnprogramming
2
2
June 8, 2017
🌐
Atlassian
atlassian.com › git › tutorials › saving-changes
How to Add Files to Git? | Atlassian Git Tutorial
December 16, 2025 - The Git add command adds a change in the working directory to the staging area. Learn all about git add and how it helps with saving changes.
🌐
GitKraken
gitkraken.com › home › learn › git add
Learn How to Use the Git Add Command | All, Interactive, Undo
September 26, 2022 - Git add is a command that allows you to stage files in your project directory. Learn how to use options: add all (-a, -all), interactive, undo add, and more.
🌐
Linux Kernel
kernel.org › pub › software › scm › git › docs › git-add.html
git-add(1) Manual Page
March 9, 2026 - This command can be performed multiple times before a commit. It only adds the content of the specified file(s) at the time the add command is run; if you want subsequent changes included in the next commit, then you must run git add again to add the new content to the index.
🌐
NSF NEON
neonscience.org › resources › learning-hub › tutorials › github-git-add
Git 05: Git Add Changes - Commit | NSF NEON | Open Data to Understand our Ecosystems
1 week ago - Add new files or changes to existing files to your repo. Document changes using the commit command with a message describing what has changed. Describe the difference between git add and git commit.
Find elsewhere
🌐
Git Tower
git-tower.com › learn › git › commands › git-add
git add - Adding changes to the staging area | Learn Version Control with Git
Adds all changes to existing files to the Staging Area. This includes changed files and deleted files - but not new files that aren't currently tracked by Git.
🌐
GeeksforGeeks
geeksforgeeks.org › git › what-is-git-add
Git Add - GeeksforGeeks
1 month ago - git add is a Git command used to move changes from the working directory to the staging area, preparing them for the next commit.
🌐
Sentry
sentry.io › sentry answers › git › `git add -a` vs. `git add .`
`git add -A` vs. `git add .` | Sentry
November 15, 2023 - The git add command is used to stage changes for a commit. While it can be used with individual filenames, Git users often want to stage all changed files in a repository at once. git add -A and git add . are two commonly used commands for doing ...
🌐
Career Karma
careerkarma.com › blog › git › a step-by-step guide to git add
A Step-By-Step Guide to Git Add | Career Karma
December 1, 2023 - The git add command sends file and folder changes to a staging area so they can later be committed to a local Git repository.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › git-add-index-stage-file-staging-commit-combine-untracked-staging-status
The git add command for beginners
Add, edit or update a files in your project. Perform the git add <filename> command to stage a file. (For multiple files, use git add .
🌐
GitLab
docs.gitlab.com › topics › git › add_files
Add files to your branch | GitLab Docs
Add, commit, and push a file to your Git repository using the command line.
🌐
Frama
gdevops.frama.io › opsindev › tuto-git › commands › add › add.html
git add — Tuto git
December 15, 2025 - https://git-scm.com/docs/git-add · Source : Froggit tutorial par Christophe Chaudier · git add [fichier] indexe le fichier nommé fichier pour préparer le commit · git add -p · -p (or —patch) allows to interactively select parts of each tracked file to commit.
🌐
Reddit
reddit.com › r/git › what's the difference between "git add *", "git add ." and "git add -a"?
r/git on Reddit: What's the difference between "git add *", "git add ." and "git add -A"?
December 4, 2020 - Awesome, thanks for that! I'll use git add -A from now on instead of git add ../../../../.. ... In this case you can use this syntax git add — -A.
🌐
Reddit
reddit.com › r/learnprogramming › what are 'git add' and 'git commit' doing and how are they different from each other?
r/learnprogramming on Reddit: What are 'git add' and 'git commit' doing and how are they different from each other?
June 8, 2017 -

I just learned the basics of github. I understand how to use it but don't quite understand why it is necessary to use 'git add --> git commit --> git push', instead of just 'git commit --> git push'.

I googled and found : "Add tells git to start tracking a file. ... You can combine both actions with git commit -a. Git commit commits the files in the index to the repository, git commit -a is a shortcut to add all the modified tracked files to the index first. Commit commits your current changes on your local repository.", but tbh I don't quite understand what it means, so perhaps I need an ELI5 version.

TL;DR: ELI5: What are 'git add' and 'git commit' doing, and how they are different from each other?

Top answer
1 of 2
4
git add tells git that it should track changes made to a particular file. Useful if you don't necessarily want to track all changes to all files in the index at every commit. git commit is like a save button. Up until that point all changes since the last commit are still just "staged" and not yet permanently written into the local git repo. This command tells git to permanently store changes made to the files you selected using git add as a node in the git tree. git commit -a is a shortcut for "save all changes to all known files in the index". It's the same as if you git add'ed all the files you're already tracking and then ran git commit. No new files will be tracked, so if something / someone writes junk like temporary files they won't get swept up into the repo. I understand how to use it but don't quite understand why it is necessary to use 'git add --> git commit --> git push', instead of just 'git commit --> git push'. It's just the way git is designed. At each commit you have to tell git "I want changes to these files to be tracked" (git add), "Save those changes to my local repo" (git commit), and "Send my changes to a remote repo" (git push). If all you want to do is track changes to the same files every time, that's what git commit -a is for.
2 of 2
3
So git works as a version control system because it stores the differences between different versions of files. This means that for every file in a directory that you want to keep track of, git must maintain a log of the differences that file experience in between each commit. This can take up a lot of space if git accidentally tracks something that you didn't want it too, for example an image file. Therefore, by default, git does not track any files when you create its root. Instead you must manually add files that you want it to track before each commit. This must be one before each commit because git has to know WHAT to commit. So add tell git "Hey this is a file im interested in, make sure to add it to my list of files to commit", whereas commit says "Im finished making changes, saves the changes to my interesting files as a commit." As and ease-of-use shortcut, the git developers added the -a option to commit to automatically add all files git knows about, but its simply running git add in the background.
🌐
Codecademy
codecademy.com › docs › git › add
Git | add | Codecademy
August 19, 2025 - This workflow demonstrates how git add enables developers to create logical, focused commits by staging related changes together, making code review and collaboration more effective.