"git add-A" and "git add." in git What are the differences?
This article is about "git add -A" and "git add ." "What's the difference. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
Two ways to branch and merge git
git add -A and git add . git add -u looks functionally similar, but there is still a slight difference
git add . It monitors the workspace state tree and uses it to commit all changes made while working to the staging area, including file content modifications and new files, but not deleted files.
git add -u: It monitors only files that have been added (i.e. tracked files) and commits modified files to staging. add -u does not commit new files (untracked files). (Short for git add -update)
git add -A: is the combination of the above two functions (abbreviation for git add --all)
Here are some examples of how to do it (Git version 1.x):
git initecho Change me > change-meecho Delete me > delete-megit add change-me delete-megit commit -m initial echo OK >> change-merm delete-meecho Add me > add-me git status# Changed but not updated:# modified: change-me# deleted: delete-me# Untracked files:# add-me git add .git status # Changes to be committed:# new file: add-me# modified: change-me# Changed but not updated:# deleted: delete-me git reset git add -ugit status # Changes to be committed:# modified: change-me# deleted: delete-me# Untracked files:# add-me git reset git add -Agit status # Changes to be committed:# new file: add-me# modified: change-me# deleted: delete-me
Summary:
git add -A Commit all changes
git add -u commits modified and deleted files, excluding new files
git add . Submit new and modified files, excluding deleted files
Different versions of git will make a difference:
Git Version 1.x:
Git Version 2.x:
Thank you for reading! About "git add -A" and "git add . "What are the differences?" This article is shared here. I hope the above content can be helpful to everyone so that everyone can learn more knowledge. If you think the article is good, you can share it for more people to see!