So for a long time I did my mozilla development using Mercurial (hg) and patch queues (mq). I've recently switched to using git instead. My mercurial workflow was a bit odd, but it had the advantage that I never lost my work and had to rewrite it. Never.
3
2
6
Since I've started using git I've lost work and had to rewrite it twice. Both times I ended up with two commits merged together that should have been separate. The second time was just now, and I realized what I did.
1
1
1
My work generally involves developing series of patches meant to be on top of each other. With git, this involves a lot of "git rebase -i" (interactive rebase). The problem I hit is the differences between interactive rebase's "edit" mode and rebase's conflict resolution mode.
1
4
I do much more of the "edit" mode than the conflict resolution mode. In edit mode, you edit the files, "git add" them, "git commit --amend", and then "git rebase --continue". But in conflict resolution mode, you edit the files, "git add" them, and "git rebase --continue".
2
1
1
3
If you mess up in conflict resolution mode and type "git commit --amend" (the one difference from edit mode), what happens? The patch you're resolving conflicts in gets magically merged into the patch below it. Two changes, tangled together. One commit message lost.
5
1
4
Pretty sure `git reset --soft HEAD@{1} && git rebase --continue` gets you back on track?
1
Though of course if you've continued you need to dig further through the reflog to get back on track.
1
Replying to @gsnedders
Not clear to me how to dig back to get the patch that I just wrote during the rebase and then I got something else merged into it, after the fact, and then continue the rebase to fix the conflicts on top. And ways to clean up after the footgun don't mean there isn't a footgun.

Aug 3, 2019 · 10:48 PM UTC

1
Replying to @davidbaron
Oh, I'm not disagreeing there's a massive footgun, just trying to give some help as to how to deal with getting out of the situation! (And really, if you're having to use `git reset`, you've probably hit a footgun.)
1