How to rebase in Git
Rebasing allows you to integrate changes from one branch into another while maintaining a linear commit history without merge commits.
As the creator of CoreUI, a widely used open-source UI library, and with over 25 years of experience in software development, I’ve used rebasing extensively to keep feature branches up-to-date with main branch developments.
The most effective approach is using git rebase to replay your commits on top of the latest changes from the target branch.
This method creates a cleaner project history compared to merge commits and makes it easier to track the evolution of features.
Use git rebase to replay your branch commits on top of another branch for a linear, clean commit history.
git checkout feature-branch
git rebase main
Rebase takes each commit from your current branch and replays them one by one on top of the target branch’s latest commit. If conflicts occur, Git pauses the rebase and allows you to resolve them before continuing with git rebase --continue. The result is a linear history where your feature commits appear as if they were created after the latest main branch commits, eliminating unnecessary merge commits.
Best Practice Note:
This is the approach we use in CoreUI development to keep feature branches current with main branch updates. Never rebase commits that have been pushed to shared repositories, as it rewrites commit history and can cause issues for other developers working on the same branch.



