3 ms·
No, I mean undoing your last action performed with git. Can be a commit, an amend, a reset. whatever.
by howinteresting 3y ago
No, I mean undoing your last action performed with git. Can be a commit, an amend, a reset. whatever.
- robertlagrant 3y agoWhat about a push :)
- masklinn 3y agoThat you can undo some actions doesn’t have to mean you can undo all actions. In the same way you can’t rollback a db rollback, you can’t undo a git gc which cleaned up a bunch of unreachable objects.
- robertlagrant 3y agoSure, but there's no generic "db rollback" command that reverses the last thing you did. This command would have to decide what to do for every previous command, no?
- howinteresting 3y agoYes, it would have to decide what to do for every previous command. Still less complicated than git rebase -i. edit: there's even prior art. Sapling has undo: https://sapling-scm.com/docs/overview/undo/ https://sapling-scm.com/docs/overview/undo/ and is GPLv2 licensed. Just look at what Sapling does.
- masklinn 3y ago> Sure, but there's no generic "db rollback" command that reverses the last thing you did. Technically nothing prevents the database automatically creating a subtransaction / savepoint for every operation you perform. > This command would have to decide what to do for every previous command, no? Yes? Not sure I see what the issue with that is. And technically much of the information is already encoded in the reflog. The two big additional informations you’d need are: 1. Tracking changes to refs as they’re not necessarily tracked by the reflog, but there should only be a small number of plumbing operations manipulating refs so it’s not really a concern. 2. Tracking changes to the index, would likely be a lot more difficult.
- seba_dos1 3y ago> Yes? Not sure I see what the issue with that is. The issue is that it sounds even more confusing in practice than status quo. If you don't understand git, you can't rely on `git undo` cause you don't know what's undoable and what isn't. And if you do understand git, you don't need `git undo` in the first place, you can already undo things by yourself.