User Tools

Site Tools


ubuntu:git:revert_or_amend_last_commit

Ubuntu - GIT - Revert or amend last commit

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.


Committed 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

ubuntu/git/revert_or_amend_last_commit.txt · Last modified: 2020/07/15 10:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki