Answers for "how to revert back to a commit in git"

3

how to revert back to previous commit in git

# This will destroy any local modifications.
# Don't do it if you have uncommitted work you want to keep.
git reset --hard 0d1d7fc32

# Alternatively, if there's work to keep:
git stash
git reset --hard 0d1d7fc32
git stash pop
# This saves the modifications, then reapplies that patch after resetting.
# You could get merge conflicts, if you've modified things which were
# changed since the commit you reset to.
Posted by: Guest on May-29-2020
4

git revert a commit

git revert --no-commit 0766c053..HEAD
git commit
Posted by: Guest on April-18-2020
0

git revert a commit

git reset 'HEAD@{1}'
Posted by: Guest on June-16-2021
0

how to revert a commit in git

Reset Git COmmit
Posted by: Guest on October-23-2021

Code answers related to "how to revert back to a commit in git"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language