News for hackers. Stuff that matters.
Re:Why large companies and fast-moving startups are banning ... by IshKebab on Saturday December 30, 2023 @05:02PM (#38819678)
Ah I think where you're going wrong is trying to merge master into PR 2. Instead you should just rebase PR 2 on top of master. Git will automatically figure out that PR 1 has been merged and drop it. If it doesn't for some reason you can just do an interactive rebase.

Git history isn't "the truth" until it's shared. There's absolutely no issue rewriting history history for your own edits that nobody else is using yet. You do that every time you press undo!

Re:Why large companies and fast-moving startups are banning ... by atq2119 on Sunday December 31, 2023 @06:06AM (#38823212)
> Git will automatically figure out that PR 1 has been merged and drop it.

Unfortunately, that part doesn't work if you let GitHub do a squash, because then the commit on main has no corresponding commit on (the branch of) PR2.

When cherrypicking the commits corresponding to PR1 during the rebase, the merge algorithm will notice that the change is already there and notify you of the empty commit if the change is completely identical. But if it isn't, that falls down.

It's still not too difficult to recover, but it's annoying.

Re:Why large companies and fast-moving startups are banning ... by IshKebab on Sunday December 31, 2023 @06:12AM (#38823242)
> Unfortunately, that part doesn't work if you let GitHub do a squash, because then the commit on main has no corresponding commit on PR2.

Did you try it? It does still work. Git will detect that the changes are identical and drop it, even if the commit hash is different.