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:
- pull latest main
- create a feature branch
- commit changes often
- push the branch
- open a pull request
- review and discuss changes
- 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:
- code review
- CI pipeline results
- discussion about risks
- approval from one or more teammates
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:
- branch protection on main
- at least one approval before merge
- CI validation to pass
- no direct pushes to protected branches
This is common in engineering organizations because it reduces production issues.
Common pitfalls
- pushing large unrelated changes in one branch
- merging without review
- rebasing shared branches used by multiple developers
- ignoring CI failures because the change seems small
Key takeaways
- Collaboration works best when teams follow a clear branch flow.
- Pull requests improve code quality and accountability.
- Branch protection is a good safeguard in production.
- Small, reviewed changes are easier to trust and deploy.