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. 🤔

@jkreeftmeijer if the demo is not about how to use git, it should probably do things more manually then...

@schnittchen Actually, it's a demo for an article where I implement a minimal HTTP server in Elixir. It needs some setup to work out at the end of the article, so I'm constantly changing past commits.

I do admit, though, I swapped the commits and amended out of laziness. 🙊

@jkreeftmeijer You're a much more prolific writer than me!

I have ~3 Elixir blogpost topics in my pipeline and I cannot finish a single one :(

@schnittchen Aw, thanks! 🤗

Are you stuck on those articles because you can't find the time to finish them, or because you need input/editing from somebody? Please let me know if I can help!

@jkreeftmeijer I feel like I have plenty to say, although it always looks a bit superficial (like this cheap trick Motivation and time are the problem that gets me stuck.

@schnittchen Oh, that’s a familiar feeling. Remember that your readers have a different experience level than you. You’ve spent time researching your subject, and they didn’t.

Also, I like the scenario article, because it shows the flaws using nested contexts and provides a clean solution to overcome them.

If you have time to work on it, let’s get one of your drafts published this month. Which one’s the most done? :)

@jkreeftmeijer There's a story to be told about the feature toggle I used to switch the entire core logic of my elixir application. Lots of stuff to say about feature toggles in general (although I can simply link Kent Beck for that).

The interesting juice is how I managed to handle asynchronous full-stack (browser) tests in the presence of the toggle, hijacking the transport mechanism behind Ecto sandbox mode...

Sign in to participate in the conversation

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!