Lesson 08
Rebase
Rebase moves your branch's work onto a newer base by replaying its commits.
Visual Explanation
Ready to run git rebase main.
Keep These Ideas
- New base
- Your feature begins from the latest point on main.
- Replayed commits
- Git creates new versions of your feature commits with new IDs.
- Private history
- Rebase work you have not shared; avoid rewriting teammates' history.
The Real Command
Terminal
git rebase mainFrom feature/login, git rebase main replays your feature commits after the newest commit on main.
Command Details
git rebase --continue--continue resumes a paused rebase. Resolve a conflict and stage the fix before continuing the replay.
git rebase -i HEAD~3-i means interactive. It lets you reorder, combine, or rename your last three unpublished commits.
git rebase --abort--abort returns to the starting point. Use it when a rebase is not going as planned.
Knowledge Check
Replay Work on a New Base
Build a linear history while recognizing when rewriting commits is risky.
Question 1 of 5
- Question 1: current
- Question 2: not started
- Question 3: not started
- Question 4: not started
- Question 5: not started