How to Rebase a Git Branch on Mac: CLI and Visual Guide
Rebasing replays your branch's commits onto a new base. It can make a feature branch easier to review before a pull request, but it rewrites those commits. Use this guide for a branch you own, and coordinate with teammates before rebasing a shared branch.
Before you start: check the branch
Open your repository in CommitPlus to inspect the commit graph and confirm which branch should receive your work. In Terminal, check that you have no uncommitted changes and fetch the latest remote history:
git status
git fetch origin
git switch feature/my-work
If git status shows local edits, commit or stash them first. In the examples below, origin/main is the branch you want to rebase onto; replace it if your team uses another base.
Rebase with the Git command line
git rebase origin/main
Git replays the commits from your feature branch after the newest commit on origin/main. If the replay finishes without a conflict, inspect the resulting history and run your tests before pushing.
Resolve a conflict or return to the old state
When Git pauses at a conflict, run git status, inspect each file, and edit it to keep the intended result. CommitPlus can help you review changes and resolve conflicting files in context. Then stage the resolved files and continue:
git status
git add path/to/resolved-file
git rebase --continue
Repeat if another commit conflicts. If the result is not what you wanted, git rebase --abort returns to the state before the rebase. See the conflict resolution walkthrough for the visual workflow.
Rebase visually in CommitPlus
With your feature branch checked out, drag the branch you want to use as the new base onto HEAD while holding Option (⌥) to choose rebase rather than merge. CommitPlus also supports dragging commits in the history view to reorder, squash, or fix up commits. Review the preview before confirming, especially when rewriting history.
The drag and drop Git guide explains the interaction. Whether you choose the app or Terminal, finish by checking your diff, commit order, and tests.
Push after a rebase
A rebase changes commit IDs. If the branch is already on a remote, a normal push can be rejected. After coordinating with anyone using that branch, use git push --force-with-lease origin feature/my-work in Terminal. The lease avoids overwriting remote work that appeared after your last fetch. Never rewrite a shared main or release branch just to tidy its history.
Looking for the right Mac Git workflow? Read our Git client comparison or download CommitPlus to try it on your own repository.
Thanh Tran
Passionate developer and creator of CommitPlus. Focused on building beautiful and performant macOS applications.