Track 05 · Lesson 5 of 7Working as a team with Git
Track 05 · Working as a team with Git
After the PR is open
Lesson 5 of 7· 8 min
Opening the PR is half the job. Then come the checks, the out-of-date warnings, the review comments and finally the merge. Each one has a short, calm routine.
Same branch, same PR#
Every fix after review goes onto the same branch. git push updates the PR in place, keeps the conversation, and re-runs the checks. Opening a new PR for fixes loses all of that.
When the PR is finally green and approved, the merge method decides what lands in the shared history. Squash is the common default: one commit per PR, easy to read and easy to undo. Follow your team's rule if it has one.
CI failed on my PR#
When: Your PR shows a red X, or someone says "your build is failing".
Shows every automatic check on your PR.
Commands to copy
$ gh pr checksWhich checks failed?
$ gh run view 987654321 --log-failedOnly the error logs
$ gh pr checks --watchWait for the new run after you push
$ gh run rerun 987654321 --failedFlaky test? Re-run only the failed jobs
My PR is out of date with the target#
When: GitHub says "This branch is out-of-date with the base branch", or teammates merged things into develop that you need.
GitHub merges the latest develop into your branch for you. This works when there are no conflicts.
Commands to copy
$ gh pr update-branch 123Easy way (no conflicts)
$ git fetch originConflict way, step 1
$ git merge origin/developStep 2: conflicts show up here, so fix them in VS Code
$ git add . && git commit && git pushStep 3: save and send
A reviewer asked for changes#
When: Your PR shows "Changes requested".
Read all the review comments right in the terminal.
Commands to copy
$ gh pr view 123 --commentsRead the feedback
$ gh pr comment 123 --body "Addressed all comments, ready for another look."Reply after pushing fixes
$ gh pr view 123 --webReply to specific line comments on GitHub
Merge my PR#
When: Your PR is approved and all checks are green. Check your team's rules first, because sometimes only leads merge.
Type this and press Enter.
Commands to copy
$ gh pr merge 123 --squash --delete-branchSame thing, no questions
$ gh pr merge 123 --auto --squashChecks still running? Merge automatically when they pass (if the repo allows it)
Check yourself