Answers for "git commit reset"

15

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
18

git cancel last commit

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

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
6

git soft reset head

git reset --soft HEAD^
//resets head by 1
Posted by: Guest on August-13-2020
7

undo local commit

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

undo most recent commit

$ git commit -m "some comment"                
$ git reset HEAD~                                          
<< edit files as necessary >>                              
$ git add ...                                              
$ git commit -c ORIG_HEAD
Posted by: Guest on June-18-2020

Browse Popular Code Answers by Language