Committed some changes, didn’t push them, and need to amend the commit:
git commit --amend -a -m "Commit message"
Committed some changes, pushed them, and need to amend the commit, do the revert operation instead, since someone might’ve already used your changes.
Committed some changes, didn’t push them, and need to undo the commit:
git reset --hard HEAD^
This will just toss away the last commit completely.
Commited some changes, pushed them, and need to undo the commit:
git revert HEAD
This will automatically create a new commit, reverting the changes from the previous
Leave a Reply