-
-
Save sutandang/fdee7f65e8fbcfee50fbb101f04ce513 to your computer and use it in GitHub Desktop.
Undo Changes
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^ -> undo last commit and save changes | |
git reset --hard HEAD~1 -> undo last commit and remove changes | |
git reset --hard HEAD~2 -> undo 2 last commits and remove changes | |
git revert commit-hash -> create new commit which reverts last commit | |
git checkout . -> remove all uncommitted changes | |
git checkout filename -> undo changes in specific file | |
git clear -df -> remove all untracked files | |
git rm filename -> remove file from index, after your did git add filename | |
git commit --amend -> change message of last commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment