Post

I will never work on a codebase that allows merge commits.

0 reposts11 likes

What about "manually rebase onto main, then create a merge commit"? It gives a lovely DNA pattern showing you the start and end of a feature, and all the steps along the way. I just wish GitHub would offer it as a one-click option ("rebase and merge" is not the same, as you don't get the bubble).

Personally, merging in a DNA pattern is my ideal for a codebase, but sadly I find many devs aren't comfortable enough with git to do it. I also dislike the pattern of "merge main into current branch" as it quickly makes the git tree look like spaghetti. Rebasing keeps things clean.

Interesting. I haven’t seen that technique in the wild. We use squash merge with the GH ui and if I need to understand the context of that squash commit, then I review the source PR and its discussion & iteration. Not git native, but usually the most useful part of the history is the conversation.

I see – one downside of not being git native though is that none of that context would be carried across if you ever pushed the repo to another remote. Or, more importantly, it becomes impossible to revert one of the individual commits that made up a PR, as all that info would be trapped in GitHub.

Ah, and sometimes when I’m trying to rebase one of my PRs onto main after a multi-step refactoring PR just got merged, it can be mentally easier to rebase onto each committed step in turn until catching up with main. You lose that option if you squash.