When I do $ git add *
sometimes I realized that git doesn't add the deleted files to the stage and I need to indicate manually if remove or add it, but I can't figure out what's the difference with $ git add --all
.
So if the asterisk () indicates 'everything' (), why git doesn't add all like **--all flag'?
I checked the git documentation git-add and some Difference between “git add -A” and “git add .” but doesn't specify the case when using asterisk.
Also the first answer in git add * (asterisk) vs git add . (period) indicates:
add * means add all files in the current directory, except for files, whose name begin with a dot. This is your shell functionality, actually, Git only receives a list of files.
So it means that is identically * and --all?
Thanks
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.
Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.
Add All Files using Git Add. The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area.
Staging is used to track new files in Git and update existing files. All file changes must be staged before they can be committed, and git add is the tool we use to add file contents into Git's staging area. The git add command can be used to stage one file, multiple files, or stage changes in an entire directory.
The difference is:
git add -A
adds everything from the top git repo folder.git add *
adds the files (as expanded by the shell, without dotfiles) from the current folder.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With