Skip to main content
Middle

Juggling Commits

Middle

Task

Fix the last commit of the newImage branch, and then move the caption branch, which depends on it, onto the updated history.

Steps

  1. Switch to newImage.
  2. Overwrite its last commit using amend.
  3. Switch to caption.
  4. Rebase caption onto the updated newImage branch.

Expected result

newImage must point to the fixed copy of its commit, and the commits of caption must sit on top of it.

What you will learn

After completing the task, you will be able to:

  • fix the last commit with amend;
  • update a dependent branch after its base is rewritten;
  • understand the chain reaction of changing commit identifiers.
Goal
localC0C1C2mainC3C3'newImageC3''C4C4'HEAD caption
Git trainer0 commands
terminal
localC0C1C2mainC3newImageC4HEAD caption