Created
January 27, 2014 06:29
-
-
Save dobestan/8643999 to your computer and use it in GitHub Desktop.
git add example, difference between [git add .], [git add *], [git add -u], [git add -A]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init | |
echo Change me > change-me | |
echo Delete me > delete-me | |
git add change-me delete-me | |
git commit -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 be 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git add -A stages All
git add . stages new and modified, without deleted
git add -u stages modified and deleted, without new