Shell/Bash: git cancel last commit Example

By

Shell/Bash Example: This is the "git cancel last commit" Example. compiled from many sources on the internet by SimpleTutorials.org

git undo commit

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

# Completely delete the changes
git reset --hard HEAD~1

git undo last commit

$ git reset --soft HEAD~1

git cancel last commit

git reset --soft HEAD~1

undo last commit

#this  will preserve changes done to your files
git reset --soft HEAD~1

#this will get rid of the commit and the changes done to the files
$ git reset --hard HEAD~1
 

undo local commit

$ git reset --soft HEAD~1

pop last commit git

#this  will preserve changes done to your files
git reset --soft HEAD~1

#this will get rid of the commit and the changes done to the files
$ git reset --hard HEAD~1


* Summary: This "git cancel last commit" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!

Others