Hacker News new | ask | show | jobs
by amphibean 4396 days ago
When do we get a git commit --undo alias? :)
4 comments

Yes, please. I don't use it often, but when I do "hg rollback" makes my life simple.
git reset HEAD^

Add --hard, --mixed, --soft for different effects. This command itself can be undone by going through git reflog and finding the appropriate commit.

To add to this, git-reset enables much more than simply 'undoing' the last commit, so it could not be adequately replaced with `git commit --undo`.
So, you might want to learn about how to put an alias into your rc file.
You mean git revert?
That reverts the diff a commit causes, but doesn't undo `git commit` which is what I suspend OP meant. Of course, there's `git reset` for that, but they were asking for an alias.
In that case, git reset