Unstage changes
June 13, 2018 ยท View on GitHub
Assumptions
- You are the contributor.
- You have files staged that you do not want committed.
Instructions
Depending on which changes you want to unstage, do one of the following.
- Unstage all changes. (Literally type
HEADhere.HEADmeans the currently checked out commit.)git reset HEAD - Unstage all changes in a directory. (Replace PATH/TO/DIRECTORY with a relative or absolute path to the directory containing the changes you want to unstage; One Windows use backslashes '\' instead of '/')
git reset HEAD -- PATH/TO/DIRECTORY - Unstage individual files (... means "and so on"; do not type them literally).
git reset HEAD -- FILE1 FILE2 ...
To avoid this problem in the future, do one of the following.
- Stage files individually from now on.
git add FILE1 FILE2 git add FILE3 - Or edit
.gitignoreto forever ignore these files and stage again. See Atlassian's article on .gitignore.vim .gitignore # use your favorite editor git add .