4 ms·
Like, git revert? Or git reset?
by paulddraper 3y ago
Like, git revert? Or git reset?
- hinoki 3y agogit reflog? All of those need you to know what you’re doing and what exactly you want to undo
- nordsieck 3y agoIt would be a wrapper: something like: * git branch hidden current * git do-the-command-here * if we call git undo, checkout the hidden branch, otherwise delete it In practice, I think a lot of people call `git lg` often enough that they can just git reset --hard to a recent commit hash, or they manually create a just-in-case branch if they're going to do something risky/dangerous.
- howinteresting 3y agoLook at the last repository-altering operation you ran and reverse the effects of it. Add a --dry-run to see what it would do, and print out the command it runs as a way to teach people more advanced things about Git. Microsoft Word has undo. Git can as well.