# Branching Strategies and Pull Requests

> Choose a branching model that supports frequent, safe releases and set up reviews and protections around it. Free notes, key concepts, resources and a mini...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/branching-workflows
Last updated: 2026-11-28

Choose a branching model that supports frequent, safe releases and set up reviews and protections around it.

Beginner · about 3 hours · difficulty 2/5

Learn first: [Git Fundamentals](https://www.internhack.in/roadmaps/tracks/devops/git-fundamentals)

How a team branches decides how often it can release. Long-lived branches mean painful merges and big-bang releases; short-lived branches keep changes small and reviewable.

### Common models

- **Trunk-based development**: everyone merges small changes into `main` at least daily, often behind feature flags. Best fit for continuous delivery.
- **GitHub flow**: short-lived feature branches plus pull requests into `main`, which is always deployable.
- **GitFlow**: `develop`, `release` and `hotfix` branches. Heavier; suited to versioned products with scheduled releases, rarely needed for web services.
- Release branches for supporting multiple versions at once.

### Guardrails

- **Branch protection**: required reviews, required status checks, no force pushes to `main`.
- **CODEOWNERS** to route reviews for infra or pipeline files to the right people.
- Merge strategies: merge commit, squash, or rebase. Pick one per repo.
- Monorepo vs polyrepo trade-offs, and path-based CI triggers for monorepos.

### Pitfalls

Branches that live for weeks, "approve without reading" reviews, and CI that runs only after merge.

**Good enough to move on:** you can defend a branching model for a given team, configure branch protection with required checks, and keep your own branches under a day or two old.

## Key concepts

- **Trunk-based development**
- **GitHub flow**
- **GitFlow**
- **Pull request reviews**
- **Branch protection and required checks**
- **CODEOWNERS**
- **Monorepo vs polyrepo**

## Mini project

Configure a GitHub repo with branch protection on main, a CODEOWNERS file, a PR template and a required status check, then open and merge a PR through the full flow.

## Check yourself

How does trunk-based development ship unfinished features without exposing them to users?

## Free resources

- [Trunk Based Development](https://trunkbaseddevelopment.com/) (trunkbaseddevelopment.com)
- [About protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches) (GitHub)

Previous: [Git Fundamentals](https://www.internhack.in/roadmaps/tracks/devops/git-fundamentals) · Next: [How Web Servers Serve Traffic](https://www.internhack.in/roadmaps/tracks/devops/web-server-concepts)

## More in Git and Collaboration Workflows

- [Git Fundamentals](https://www.internhack.in/roadmaps/tracks/devops/git-fundamentals)
- [Branching Strategies and Pull Requests](https://www.internhack.in/roadmaps/tracks/devops/branching-workflows)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
