gitpractice.dev

brewly — Ch.6 · Move a branch off another

Exercise 8 of 8

Before you start

rebase --onto

Sometimes a branch was started from another branch by accident. A plain rebase would drag both along.

git rebase --onto <new base> <old base> takes only the commits after the old base and replays them on the new base.

git log --oneline --graph --all
see which commits sit where
git rebase --onto <new> <old>
move the commits after <old> to <new>
You can reopen this any time with “Lesson”.

Continue on a desktop

Typing git on a small screen is no fun. Open this page on a laptop or desktop to practise.

Back to the path