Git - Undo Commit

Sunday, May 25 2020 1 min read

Unless you have pushed your commit to remote, you can always undo your last commit, you can try a couple different options:

From this stack overflow answer :

Reset and unstage all changes of last commit (so all files appear under Untracked Files):

git reset HEAD~

Reset and keep previously added files staged (so all files previously selected show under Changes to be committed)

git reset --soft HEAD~

Make changes to your files

Stage your changes

git add -A

Don’t forget to make a commit

git commit -m "my awesome commit message"
Share