4 ms·
git config --global alias.undo 'reset --soft HEAD~1' Not that I would include this in my own shell. To the authors two example uses: 1) Undoing an amended comm
by phonebucket 5y ago
git config --global alias.undo 'reset --soft HEAD~1'
Not that I would include this in my own shell. To the authors two example uses:
1) Undoing an amended commit. But if you're comfortable amending a commit, can't you just amend your amended commit?
2) Accidentally commiting an incorrectly resolved merge conflict. Revert the change if you want to be non-destructive. Reset HEAD~1 otherwise.
- renewiltord 5y ago1. I believe it’s not that you want to amend it, but that you want to restore its pre-amended state. I would use the reflog to look that up and then reset to it but this makes that easy and hence, more accessible (which is good) 2. Yeah, but I think the UX improvement of a single command to say “Go back to where I was” is reasonable.