Practice: a week on a team

Run one week of a real project through the terminal, start to finish.

16of 16
≈ 14Min read
3Parts

The situation

You are adding a discount field to the price list. While you work, a colleague lands a fix on main. Your branch has to catch up, one of your changes collides with theirs, and at the end the work has to be on the server with a version tag on it.

Every command you need has appeared in the previous fifteen lessons. Nothing here is new — the point is doing it in one go, in the right order, without stopping to think about which of the three places a change is in.

The order of operations

the shape of it, with the details left to you
# 1  start from what everyone has
# 2  a branch, named after the work
# 3  commit as you go — small, with real messages
# 4  someone else pushes to main
# 5  fetch, and look before you do anything
# 6  rebase onto origin/main, and resolve the conflict
# 7  force-with-lease your own branch
# 8  merge it into main, tag the release, push both

Two things that trip people up here

  • After a rebase your branch needs --force-with-lease, because the commits have new ids. That is expected on your own branch.
  • Resolving a conflict means editing the file and git add-ing it. Git does not check whether the markers are gone; you do.

Practice