rebase
Rebase is a Git version control operation that moves your own modifications to the latest state of the shared code, as if you had started work from there.
In plain terms
Imagine that you write a new chapter into last week's version of a joint manuscript while others continue to improve the original. A rebase is like extracting your chapter and inserting it again into the current, fresh version of the manuscript. The end result looks as if you had started from today's text all along.
Programmers work on so-called branches in the Git version control system to avoid interfering with each other. If the main branch moves ahead, rebase adjusts your own branch to it. This keeps the history linear and easy to read.
The other solution for this situation is merging. It preserves that the two threads ran in parallel and creates a separate connecting entry. In contrast, rebase rewrites history: it provides a cleaner picture, but your modifications receive new identifiers.
In the AI era, you hear more about it because coding agents often perform it themselves. If multiple agents work on the same code simultaneously, their work must be regularly aligned with the current state.
How it works
- Git finds the point where your branch diverged from the main branch.
- It sets aside your subsequent changes (commits) one by one.
- It sets your branch to the latest state of the main branch, as if you were starting from there.
- The set-aside modifications are reapplied one by one to this base; each receives a new identifier.
- If one of the modifications conflicts with others' work, the process stops, and you (or the agent) must decide which version remains.
An everyday example
A coding agent starts fixing a bug in your online store's code in the morning, while a colleague uploads another change. Before the agent submits its work, you see this in the log: 'rebase onto main' – meaning it moved its fix on top of the colleague's latest version. If it finds a conflict, depending on its settings, it either resolves it itself or stops and asks which solution to keep; in both cases, you should review the result.
Who is affected
A common misconception
Limits and risks
- Do not rebase a branch that others use and that has already been shared, because their copies will then diverge from the rewritten history.
- If you have already pushed the branch to the remote repository, after a rebase you can only update it with a force push, which, if used carelessly, can overwrite others' changes; the safer version is the --force-with-lease flag.
- With many modifications, the same conflict may need to be resolved multiple times, which is time-consuming and prone to errors.
- If a coding agent performs the task, verify the result: even with good intentions, it may discard important lines while resolving conflicts.
Similar, but not the same
- merge – Merge preserves parallel histories and creates a connecting entry, while rebase rewrites the history into a straight line.
- cherry-pick – Cherry-pick copies selected individual changes (commits) to another branch, while rebase moves the branch's entire sequence of changes onto a new base.
- squash – Squash combines multiple changes into a single entry, while rebase moves them – although during an interactive rebase you can also combine them.
Related concepts
A brief history
Rebase is a fundamental operation in the Git version control system; Git was launched by Linus Torvalds in 2005 for Linux kernel development. The operation's name literally means 're-founding': your work is placed on a new foundation.
Where things stand
As of late 2026, rebasing is a routine part of everyday software development and a mandatory step before submitting code at many teams. Coding agents also do it on their own, so the term is increasingly reaching non-programmers.
Also known as
rebase · git rebase · rebasing · rebase-el · re-founding · re-foundation · interactive rebase · interactive rebase
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.