Lesson09
advancedReplay Work with git rebase
Goal
Move a feature branch onto the latest main, so its history is a straight line.
You started feature/search a while ago. Since then main has moved on with a security fix. Instead of merging main into your branch (and adding a merge commit), replay your two commits on top of the new main.
Objectives
0/2feature/searchsits on top of the latestmain, in a straight line. (Current objective)- Both search commits are still on
feature/search. (Not started)
Your task nowStep 1 of 2
feature/search sits on top of the latest main, in a straight line.
Need help?
Reference
What rebase does
Step 1 of 2
feature/search branched off at B. main has since gained C.
Step 1 of 2. `feature/search` branched off at B. `main` has since gained C.
Merge or rebase?
git merge main
- Keeps history exactly as it happened
- Adds a merge commit
- Safe on shared branches
git rebase main
- A straight, easy-to-read history
- Rewrites your branch's commits (new ids)
- Only for commits nobody else has built on
Preparing your workspace…
Repository Graph
Click a commit to inspect it
Working Tree
Not a Git repository yet
No unstaged changes
Your working tree matches the staging area.
Staging Area
Files prepared for the next commit
No staged changes
Use git add to prepare files for your next commit.
Repository
Committed history
No commits yet
Use git commit to record staged changes.
