Git add-a and git Add. Git add-u looks similar in function, but there's a difference.
git Add. : The state tree of the workspace is monitored and used to commit all changes to the staging area, including file content modification (modified) and new files, but excluding deleted files.
git add-u : Only the files that have been added (that is, tracked file) are monitored, and the modified files are submitted to staging area. Add-u does not submit new files (untracked file). (The git add–update abbreviation)
git add-a : A collection of the top two features (git add–all abbreviation)
Here is a detailed example of how to better understand (Git version 1.x):
Git init
echo change me > Change-me
echo Delete me > Delete-me
git add change-me delete-me
git commi T-m initial
echo OK >> change-me
rm delete-me
echo 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 BES committed:
# New file: add-me
# modified: change-me
# Changed but not updated:
# deleted: delete-me
git reset
git add-u
git status
# Changes to be committed:
# modified: change-me
# deleted: delete-me
# untracked files:
# add-me
git reset
git add-a
git status
# changes to be committed:
# New file: add-me
# modified: change-me
# deleted: delete-me
Summarize:
· Git add-a commit all Changes
· Git add-u commits modified (modified) and deleted (deleted) files, not including new files git Add. Submit New and modified (modified) files, excluding deleted (deleted) files
Different versions of Git will differ:
Git Version 1.x:
Git Version 2.x:
Reprinted from: http://www.cnblogs.com/skura23/p/5859243.html