Answers for "git staus to last commit"

4

move to last commit

git reset --hard HEAD
Posted by: Guest on May-12-2020
0

git return to last commit

git log
    commit 101: bad commit    # Latest commit. This would be called 'HEAD'.
    commit 100: good commit   # Second to last commit. This is the one we want.
To restore everything back to the way it was prior to the last commit, we need to reset to the commit before HEAD:

git reset --soft HEAD^     # Use --soft if you want to keep your changes
git reset --hard HEAD^     # Use --hard if you don't care about keeping the changes you made
Posted by: Guest on January-12-2022
2

how to revert to last git commit

git checkout . #This will get rid of all uncommited change
Posted by: Guest on December-21-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language