4 ms·
I'm liking git for it's internals, but the UI is pretty bad in places: # undo commit git reset --soft HEAD~1 hg rollback # undo changes gi
by digisign 12y ago
I'm liking git for it's internals, but the UI is pretty bad in places:
# undo commit
git reset --soft HEAD~1
hg rollback
# undo changes
git checkout -- <file>
hg revert <file>
etc. I look up the git equivs up on stack overflow every time I need them.
- kazinator 12y ago"git checkout -- <file>" does not actually revert a file from the branch. It reverts it from the index. It's only a revert-to-branch operation if you don't have anything in the index. So if you land into one of those "gituations" where use of the index is being foisted upon you, it might not do what you are used to. There is also the flaw that the -- separator is not required for giving paths: "git checkout <file>" also works. So if you are trying to check out a branch or tag, and make a typo and accidentally type the name of a file which has unstaged changes, you lose them. It doesn't rename the original file to a backup like good old "cvs up -C file".
- digisign 12y agoIC. I added the " -- " syntax because that's what it recommends when doing a "git status".