Git · Lesson 5 of 8 · 3 min read
Remotes and team collaboration
Remotes, fetch, pull and push
git remote -v
git fetch origin # download objects and update origin/* (safe, no merge)
git pull # fetch + merge (or rebase) into the current branch
git pull --rebase # rebase local commits on top of upstream (linear history)
git config --global pull.rebase true
git push -u origin feature/x # push and set upstream tracking
git branch -vv # local branches with upstream and ahead/behind counts
git push origin --delete feature/x
fetch is always safe; pull changes your branch. Configure pull.rebase or pull.ff only to avoid accidental merge commits.
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
Pull requests and code review
A healthy PR workflow:
- Small PRs (a few hundred lines) reviewed quickly — big PRs get rubber-stamped.
- Branch protection on
main: required reviews (1–2), required status checks (CI, tests, security scans, Terraform plan), up-to-date with base, linear history, no force pushes, signed commits if required. - CODEOWNERS automatically requests reviews from the owning team for specific paths (
/terraform/prod/ @acme/platform-leads). - Merge queues test PRs against the latest main in order, preventing "green PR breaks main" races in busy repos.
- Signed commits/tags (GPG, SSH or Sigstore gitsign) verify authorship — part of supply-chain security.
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
Forks vs branches
Internal teams usually work with branches in one repository. Forks suit open source and untrusted contributors (CI on fork PRs must not get secrets — see GitHub Actions).