# Rebase

> Your commits move to start from a newer point. The past reads as one line.

**Field:** Software Development  
**Category:** Version Control  
**Also known as:** Git Rebase

## Think of it like

Think of it like moving your notes to the end of a list. Same notes, now after all the rest.

## Definition

A rebase moves your branch's commits so they start from a newer point. Git takes each of your commits and replays it on top of the other branch. The result is a straight line of history with no merge commit. Each moved commit gets a new code, because its starting point changed. That is why you should not rebase commits that others have already pulled.

## Example

Jack's search branch started before Emma's latest work. He rebases onto main, and his commit now comes after hers.

## Example code

```console
$ git rebase main
Successfully rebased and updated refs/heads/search.
$ git log --oneline -2
85ece06 Add search
26b91bd Blue greeting
```

Jack's commit now sits on top of the newest commit on main.

## Why it matters

A straight history is easier to read and search. Many teams rebase before they merge.

## Common mistake

Rebasing a branch others share. Their copies no longer match, and work can get lost or doubled.

## Three principles

- **Replay on top.** Your commits move to a newer base.
- **Straight line.** No merge commit is made.
- **Only your own.** Never rebase what others pulled.

## Related terms

- [Merge](https://learn.benibix.com/term/development/merge)
- [Branch](https://learn.benibix.com/term/development/branch)
- [Commit](https://learn.benibix.com/term/development/commit)
- [Cherry-Pick](https://learn.benibix.com/term/development/cherry-pick)

## Told apart from

- [Merge vs Rebase](https://learn.benibix.com/compare/merge-vs-rebase): Both join two branches. A merge keeps both lines and ties them with a new commit; a rebase moves your commits into one line.

## Taught in

- [Git Rebase and Cherry-Pick](https://learn.benibix.com/learn/development-version-control/git-rebase-and-cherry-pick): Git and GitHub, 6/13

---

Source: https://learn.benibix.com/term/development/rebase
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
