Answers for "Undo git commit"

42

undo commit

# KEEP CHANGES
git reset --soft HEAD~1

# REMOVE CHANGES
git reset --hard HEAD~1
Posted by: Guest on April-07-2020
16

git undo commit

# Uncommit the changes
git reset --soft HEAD~1

# Completely delete the changes
git reset --hard HEAD~1
Posted by: Guest on September-04-2020
19

git cancel last commit

git reset --soft HEAD~1
Posted by: Guest on March-30-2020
7

Undo git commit

$ git reset --soft HEAD~1
Posted by: Guest on April-09-2020
1

Undo git commit

$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~                              # (1)
[ edit files as necessary ]                    # (2)
$ git add .                                    # (3)
$ git commit -c ORIG_HEAD                      # (4)
Posted by: Guest on August-23-2021
0

undo git commit

$ git reset HEAD^
Posted by: Guest on September-08-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language