git-extras
git-extras copied to clipboard
git undo should work on first commit too
It works fine except on the first commit it gives this error:
> git undo
fatal: ambiguous argument 'HEAD^': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
I think it should do this for the first commit:
git update-ref -d HEAD
@pathikrit Good point. Would you submit a pull request? Thanks!
I came here to make this very point (although about "back"). I don't know how to tell there's only one commit, but I'll see if I can figure it out and file a PR.
Idle curiosity: why do both "back" and "undo" exist? Isn't "undo" sufficient, as it covers both soft and hard resets? It seems confusing to have both.
@vr8hub Look like a legacy issue. Now I deprecate the git-back in https://github.com/tj/git-extras/pull/820.