Rebase Basics
rebase replays your commits on top of another branch for a straight history.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git switch -q -c feat
echo f > f.txt && git add f.txt && git commit -qm 'feat'
git switch -q main
echo m > m.txt && git add m.txt && git commit -qm 'main'
git switch -q feat
git rebase -q main
git log --format=%sResult
feat main first
Exercise
Replay commits.
git main
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.