git rebase: Rewrite your branch's commits as if they started from the tip of another branch — producing a linear history. git rebase moves your commits so they start from a different point, usually the latest version of main. Git takes your commits, sets them aside, updates the base and replays them one by one.
The result is a straight, readable history without merge commits for every update. Interactive rebase, git rebase -i, also lets you reorder, combine, reword or drop commits before sharing them, so a messy series of work-in-progress commits becomes a clean story.
What should you keep in mind with git rebase?
The golden rule: only rebase commits that nobody else has based work on. Rebasing creates new commits with new IDs, which causes trouble for anyone holding the old ones. Rebase your own feature branch freely, then push with --force-with-lease. If a rebase goes wrong, git rebase --abort returns everything to how it was.
Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback