Answers for "how to reset head to previous commit"

5

git reset to commit

# reset to specefic commit
git reset --hard <commit id>

# to go back one step 
git reset --hard HEAD~1

# note: use --soft to keep file changes
Posted by: Guest on March-05-2021
0

git checkout previous commit HEAD

git checkout <commit_id>
git checkout -b <new branch> <commit_id>
git checkout HEAD~X // x is the number of commits to go back
Posted by: Guest on March-08-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language