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
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
git reset to latest commit
git reset --hard HEAD~0
will go to latest commit.
git reset --hard HEAD~1
will go to last but one commit.
Note: Be careful while running this command. it can't be irreversible
git roll back to specific commit
//Git Rollback to a specific commit via Mac terminal
//Navigate to project and open git log
cd projectname
git log --oneline
//Locate and checkout the desired commit ID
git checkout abc1234 .
//(Type q to quit the git log)
//Stage All changes, commit with comment, and push to remote
git add -A
git commit -m "Revert commit: abc1234"
git push
git go back to previous commit
git checkout 12feg3435 #commit ID
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us