Wiki

Removing the last commit in git

A one shot command to remove the last commit in git.. useful when you want to re-apply a patch.

EDITOR="echo noop >" git rebase -i HEAD~1

or:

git reset --hard HEAD~1
Permalink. First published on Fri 28 December 2014.