Rebasing
Part of the Git course
You branched off main on Monday to add a search box. It is now Thursday, you have three commits, and in the meantime four other people have pushed to main. Your branch is built on a version of the project that no longer exists anywhere. Before your work can join main, those two lines of history have to be brought back together, and Git gives you two different ways to do it.
The first is a merge, which records the truth: two lines of work existed side by side, and here is the commit where they came together. The second is a rebase, which rewrites your side of the story so it looks like you started your work this morning, from the current tip of main. Merge is honest about what happened. Rebase is tidy about what it leaves behind.
Want to learn Git Rebasing in a real environment?
Click below, get a fresh Linux box with Git ready to go, and work through Rebasing hands-on with an AI tutor that knows your code.
Start this lessonRebasingWhat you'll learn
- Git rebase
- Replay on top
- Linear history
- When not to rebase
