Rebase Considered Harmful
fossil-scm.org
Rebase Considered Harmful
1–10 of 16 posts
Re: Rebase Considered Harmful
#2Re: Rebase Considered Harmful
#3> 3.0 Rebase encourages siloed development
You need a strong culturally enforced habit of "commit early, commit often ... rebase early, rebase often, push early push often" with all development happening in branches that are visible to everyone (GitHub, GitLab etc) to avoid this.
I conceptually like a main branch with a clean straight-line history with no merge commits and clear commit messages. It takes discipline. The discipline is helped by a cultural environment where anyone can request changes in any PR, where teams, not individuals, own projects, where clarity of the commit message is equally important as the code, and where is a strong preference for short-lived branches and small PRs.
I also recommend opening a PR as soon as a single commit has been made in a branch and announcing the PR in a dedicated channel so everyone has a chance to follow the development.
This kind of thing is not going to work in every type of project in every organization, but I have developed a preference for it.
Re: Rebase Considered Harmful
#4We discuss this in detail with Richard on next week's episode of The Changelog podcast. https://changelog.fm
Re: Rebase Considered Harmful
#5Rebase is very useful:
* pre-processing step to a merge. The developer can see that the merge to main will be successful.
* when the branch has cherry picked commits from main, those cherry picks will disappear from the feature branch's commit list.
* rebase also includes the ability to combine commits (get rid of all those WIP commits)
* rebase allows reorder of commits.
rebase is so so much more than just rearrange commit pointers in some "bad" ways.
Failure to include functionality just invites my old fallback when a rebase fails badly.
git checkout main;
git checkout -b new_branch;
git diff -R old_branch | git apply;
git add -A ;
git commit
Removing a tool just invites developers to work around the gap.
Re: Rebase Considered Harmful
#6We discuss this in detail with Richard on next week's episode of The Changelog podcast. https://changelog.fm
Do you know why he is doing publicity this year? He was on another podcast recently too.
Perhaps he was asked.
Re: Rebase Considered Harmful
#7Re: Rebase Considered Harmful
#8Removing uninteresting cruft before publishing is a good idea, and rebase is a good tool for achieving that.
Re: Rebase Considered Harmful
#9My average PR represents maybe an afternoon of work before it's reviewed and merged and shipped. With such short-lived branches, siloing isn't a big deal.
I'd suggest that shipping multiple times a day renders rebase's harm pretty irrelevant.
But if we flip that around, are we shipping multiple times a day because we lack tooling and workflows for non-silo'd development? We ship PRs quickly because a long lived PR is hard to maintain and keep up to date. If that wasn't a problem, would we ship less often?
Re: Rebase Considered Harmful
#10Sigh. Rebase is very useful: * pre-processing step to a merge. The developer can see that the merge to main will be successful. * when the branch has cherry picked commits from main, those cherry picks will disappear from the feature branch's commit list. * rebase also includes the ability to combine commits (get rid of all those WIP commits) * rebase allows reorder of commits. rebase is so so much more than just rea…
This.
It's either a clean rebase, or messing the repo history with merge-commits, or merge with no ff and no commit onto HEAD followed by a local commit.
And rebase is far better and far cleaner and far simpler than any alternatives.
And rebase starts to become necessary as soon as two or more people start to work on the same mainline branch. After all, what rebase does is help get your branch (local or remote) updated and tied to the HEAD of a branch without screwing up the commit history. Isn't this one of the most basic usecases for a CVS?