DELAPARRA
Index
Color
NL
Category: Git commands

git rebase

Explained by Updated

What is git rebase?

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.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about git rebase

How is git rebase used in practice?

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.

At a glance

CategoryGit commands
Explained by
Updated

More Git commands terms

All terms starting with G

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.