Last active
December 24, 2015 12:39
-
-
Save nahurst/6799432 to your computer and use it in GitHub Desktop.
Undoing things on git
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 reset --soft HEAD^ # when you just committed something you didn't mean to and you want to change the contents and the message | |
git commit --amend # when you want to change the commit message you just made | |
git reset file # when you have a file staged for delete that you want to unstage | |
git checkout file # when you want to restore that file you unstaged file to it's original version | |
git reset HEAD file # when you want to unstage a staged change | |
git reset --soft "HEAD^" # when you just committed something, but you want to undo the commit and revert everything to how it was staged before the commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment