Collaborating on Hosted Repositories

Use GitHub, GitLab or Bitbucket for pull requests, code review, issues and branch protection.

Beginner · about 3 hours · difficulty 1/5

Learn first: Version Control with Git

Git itself is local; a hosting platform gives your team a shared remote plus collaboration features. The concepts are nearly identical across platforms, so learn one well.

What you do on these platforms

  • Pull requests / merge requests: propose a branch for merging, discuss it line by line and require approvals.
  • Code review: read others' changes critically but kindly; look for correctness, clarity, tests and security, not just style.
  • Branch protection: require passing CI and at least one review before anything reaches main.
  • Issues and projects: track bugs and features, link them to PRs.
  • Forks: contribute to projects you do not have write access to (the open source workflow).

A healthy team workflow

Most teams use a variant of trunk-based development: short-lived feature branches, small PRs, merge to main often, deploy from main. Long-running branches that drift for weeks cause painful merges.

Pitfalls

  • Huge PRs that nobody can meaningfully review. Aim for changes a reviewer can understand in 15-20 minutes.
  • Leaving CI red and merging anyway.

You are ready to move on when you have opened a PR with a clear description, responded to review comments and merged it with CI passing, ideally on an open source project.

Key concepts

  • GitHub: Largest community and open source ecosystem.
  • GitLab
  • Bitbucket
  • Pull requests and code review
  • Branch protection rules
  • Forking workflow
  • Trunk-based development

Mini project

Fork a small open source project, fix a typo or tiny bug, and open a pull request following its contribution guide.

Check yourself

Why do teams require CI to pass and a review before merging into main?

Free resources