News for hackers. Stuff that matters.
Re:I Kind of Like Rebasing by IshKebab on Friday June 21, 2024 @05:33PM (#40754060)
Rebasing is definitely the better option if you can do it. Sometimes it is just too much of a pain resolving conflicts if you are rebasing a branch with lots of commits and there are lots of conflicts. In that case I normally squash and then rebase. Branches where there's enough history to be worth maintaining multiple commits should - 99% of the time - be separate PRs.

The rare exception is when you have multiple people contributing to a branch before it is merged into master, but for obvious reasons you should avoid that when at all possible.

Re:I Kind of Like Rebasing by recursive on Friday June 21, 2024 @05:49PM (#40754196)
> Rebasing is definitely the better option if you can do it.

A bold claim.

> but for obvious reasons you should avoid that when at all possible.

Obvious? I do this somewhat regularly and haven't had a problem. I don't even know what the problem is supposed to be.

Also, I never rebase. Maybe that's why I don't have a problem? When you rebase, commit A becomes commit A'. This becomes a problem when you need to determine whether a particular commit is an ancestor or not. A and A' have different commit hashes, so the identity of the commit becomes somewhat ambiguous.

My workflow is do all development using merge only. When the code review is complete, squash to master. I have found no down sides to this. But I'm not trying to sell it to you either.

Re:I Kind of Like Rebasing by ycombobreaker on Friday June 21, 2024 @06:52PM (#40754669)
> Branches where there's enough history to be worth maintaining multiple commits should - 99% of the time - be separate PRs.

I appreciate that anyone saying this is probably already on the same wavelength as me, but I don't find this to be true for myself. Many times, complex application features end up represented as a series of related, but atomic/meaningful changesets. I want the pull request to make sense as a whole, but expect that code review or audits are easier to accomplish diff-by-diff.

I see it like building a recipe. I want to hide all of the false starts, sloppy mistakes, do-overs, and checkpoints, because they are useless from a historical standpoint. But I still may want to publish a sequence of changes that accomplishes something.

Re:I Kind of Like Rebasing by IshKebab on Saturday June 22, 2024 @03:51PM (#40761641)
Yeah that's fine, you can just push the series of commits and then squash them when they are merged. Both Gitlab and Github can do squash merges.
Re:I Kind of Like Rebasing by technojamin on Friday June 21, 2024 @05:43PM (#40754128)
Git rerere basically solves this: https://git-scm.com/book/en/v2/Git-Tools-Rerere