A rebase rewrites the history of your branch, so that it’s as if you just branched off and then coded all your changes in one sitting.
It will go through each of your commits and try to apply them one after another. If something changed on the base branch that conflicts with your changes, it will prompt you to adjust your commit. You adjust it so that looks as if you just coded it on top of the base branch.
When you have lots of commits on your branch, this can mean that while you’re rebasing, you have to then also change your following commits which happened to touch the same lines as a previous commit. This can mean additional, stupid work.
As such, a workflow using rebases (“trunk-based workflow”) works best, if you can rebase often and merge back early. You won’t get merge conflicts when merging back, nor merge commits, because you resolved these while rebasing.
In particular in smaller teams where you have tight-knit communication, this workflow is absolutely stellar. It completely bypasses so many pain points that folks have with Git.
Merge conflicts are significantly reduced when you merge often and a trunk-based workflow removes the ceremony that typically prevents teams from doing just that.
A rebase rewrites the history of your branch, so that it’s as if you just branched off and then coded all your changes in one sitting.
It will go through each of your commits and try to apply them one after another. If something changed on the base branch that conflicts with your changes, it will prompt you to adjust your commit. You adjust it so that looks as if you just coded it on top of the base branch.
When you have lots of commits on your branch, this can mean that while you’re rebasing, you have to then also change your following commits which happened to touch the same lines as a previous commit. This can mean additional, stupid work.
As such, a workflow using rebases (“trunk-based workflow”) works best, if you can rebase often and merge back early. You won’t get merge conflicts when merging back, nor merge commits, because you resolved these while rebasing.
In particular in smaller teams where you have tight-knit communication, this workflow is absolutely stellar. It completely bypasses so many pain points that folks have with Git.
Merge conflicts are significantly reduced when you merge often and a trunk-based workflow removes the ceremony that typically prevents teams from doing just that.