Collaboration Workflows

Git is not only about saving code. It is also about helping teams collaborate without stepping on each other.

Typical team workflow

A common team flow looks like this:

  1. pull latest main
  2. create a feature branch
  3. commit changes often
  4. push the branch
  5. open a pull request
  6. review and discuss changes
  7. merge after checks pass
sequenceDiagram participant Dev as Developer participant Repo as Remote Repo participant Review as Pull Request participant Main as main Dev->>Repo: git pull Dev->>Repo: git push feature branch Repo->>Review: create PR Review->>Dev: review comments Dev->>Repo: update branch Review->>Main: merge after approval

Pull requests

A pull request is a review process before code is merged. It usually includes:

This is common in production teams because it adds quality control.

Pull before you push

Before starting work, update the branch from the remote:

git pull origin main

This reduces drift and merge conflicts.

Rebase versus merge

Both are valid, but they serve different purposes.

Merge

Merge keeps the history visible and is easy to understand.

git merge feature/login

Rebase

Rebase moves the branch onto the latest base branch, rewriting commit history.

git rebase main

Use rebase carefully. It is best for feature branches that are not yet shared widely.

Fixing common collaboration issues

Someone else changed the same file

Pull the latest changes and resolve conflicts before finalizing the work.

A branch is too old

Rebase or merge main into the branch so it is current.

A PR is too large

Split it into smaller chunks. Small pull requests are easier to review and less risky.

Production example

A platform team may require:

This is common in engineering organizations because it reduces production issues.

Common pitfalls

Key takeaways