Track

Rewriting History

5 Lessons, then a Checkpoint of 3 Challenges.

Builds on Remotes & Collaboration and Undoing Things.

Lessons

Follow them in order, or play any Lesson once the Track is unlocked.

  1. Rebase

    You started a branch, made a few commits, and meanwhile main moved on. Before your work goes back into main, you want it to build on the newest main.

    3 Challenges.

    New commands:

    • git rebase
  2. Rebase conflicts

    A rebase replays your commits one at a time, and each replay is a small merge: git applies that commit's change to the new history. If a commit changes the…

    3 Challenges.

    New commands:

    • git rebase --continue
    • git rebase --abort
    • git rebase --skip
  3. Cherry-pick

    Sometimes you need one commit from another branch, not the whole branch. A fix was made on a branch that isn't ready to merge. A useful commit is stuck in an…

    3 Challenges.

    New commands:

    • git cherry-pick
    • git cherry-pick --continue
    • git cherry-pick --abort
  4. Interactive rebase

    While you work on a branch, its history gets untidy. There's a commit that was only for testing, a fix for a typo you committed an hour ago, a message with a…

    4 Challenges.

    New commands:

    • git rebase -i
  5. Rewriting shared branches

    So far you've rewritten commits that were only in your repository. This Lesson covers two situations where other people are involved: catching up with a…

    3 Challenges.

    New commands:

    • git pull --rebase
    • git push --force-with-lease

Checkpoint

The Track ends with a Checkpoint of 3 Challenges that use only this Track's commands and those of the Tracks it builds on. Passing the Checkpoint completes the Track, even before you have played every Lesson.

Play the Rewriting History Checkpoint