Sometimes, `git rebase -i HEAD~2`, then flipping the commit order and `git commit --amend` is just the most convenient way to amend the second last commit. 🤷‍♀️

@schnittchen Yes, I definitely underuse `--fixup`, and that would probably be the proper way to do it indeed. However, I'm currently grooming an example repository to show clear steps for an article I'm writing, so there's a lot of rebasing going on. I tend to lose track of the fixup commits, and autosquashing them is another step to take.


@mvz Yes, but that’d require me to write “edit” in the rebase file instead of `ddp` to swap the commits. Properly rebasing is a better idea, this was just laziness.

@jkreeftmeijer This is such a common action that I'm now thinking of making a `git flip` alias, just for swapping the last two commits.

@mvz [Obligatory “you should use --fixup instead”-reply]

But yes, that sounds like a nice add-on. I’m wondering how you’d implement something like that, though. 🤔

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!