When using Mercurial it is possible to issue the following command:
hg revert --all --rev <revision>
The content of the working directory is set to the specified <revision> but you stay where you are in the tree (same parent, branch, etc).
How to do that in git?
It should behave like git reset --hard <commit> without moving the branch pointer.
TL;DR
git config alias.revert-all 'read-tree -um HEAD'
git revert-all <commit>
A comparison/test of all variants i found can be found here: http://git.io/vk9it
git read-tree -um @ $thatcommit
will do it. That's "transition the index and worktree from the HEAD aka @ commit to $thatcommit, as for checkout (but without touching HEAD)".
When what you're doing isn't a good match for any of the convenience commands, the core commands have your back :-)
If you need to blow away uncommitted changes, git reset --hard possibly with some selection of git clean options to clear out completely untracked files first, git really hates stomping on uncommitted work without an explicit order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With