How to Set Up Feature Branches in GitHub
Committing directly to main is a recipe for broken builds, untested code in production, and developers accidentally overwriting each other's work. A feature branch workflow isolates changes until they are reviewed and tested, then merges them cleanly into the main branch. This is not optional overhead — it is the foundation of professional software development.
GitHub provides the branch management, protection rules, and pull request tools needed to implement a robust feature branch workflow. This guide covers setting up the conventions, configuring branch protection, and establishing the review process that keeps your main branch deployable at all times.
Step-by-step guide
Define your branch naming convention
Establish a consistent naming pattern that the entire team follows. A common convention is type/description — for example, feat/user-onboarding-flow, fix/login-timeout-error, or chore/update-dependencies. Include the ticket number if your team uses Linear or Jira: feat/VAN-123-user-onboarding-flow. The name should tell a reviewer what the branch contains without clicking into it.
- Define allowed prefixes: feat/, fix/, chore/, docs/, refactor/, test/
- Use kebab-case for the description portion with no more than 5-6 words
- Optionally include the ticket ID for traceability: feat/VAN-123-description
Configure branch protection rules on main
Navigate to your repository Settings, then Branches, and add a branch protection rule for main. Enable 'Require a pull request before merging' and set the minimum number of approving reviews to 1 (or 2 for critical repositories). Enable 'Require status checks to pass before merging' and select your CI workflow. These rules make it physically impossible to push untested code directly to main.
- Enable 'Require a pull request before merging' with at least 1 required approval
- Enable 'Require status checks to pass' and select your CI test and lint jobs
- Enable 'Require branches to be up to date before merging' to prevent merge conflicts in main
Set up the pull request template
Create a .github/pull_request_template.md file in your repository with sections for Summary (what and why), Changes (bullet list of what changed), Testing (how the reviewer should verify), and Screenshots (if applicable). A consistent PR template ensures reviewers get the context they need without asking, and authors think through their changes before requesting review.
- Add a Summary section with a prompt to explain what the PR does and why
- Include a Changes section with a placeholder bullet list
- Add a Testing section asking the author to describe how they tested the changes
Create and push a feature branch
When starting new work, always branch from the latest main: git checkout main, git pull, then git checkout -b feat/your-feature. Make small, focused commits as you work — each commit should represent a logical unit of change, not a day's worth of random edits. Push your branch to GitHub early and often so your work is backed up and visible to teammates.
- Always pull the latest main before creating a new branch to avoid starting from stale code
- Make atomic commits with descriptive messages that explain the 'why' not just the 'what'
- Push to the remote after your first commit so the branch exists on GitHub immediately
Open a pull request and request review
When your feature is ready for review, open a pull request from your feature branch to main. Fill in the PR template completely, assign reviewers, and link the relevant ticket. Mark the PR as a draft if it is not yet ready for review but you want early feedback. Use GitHub's reviewers feature to assign specific people, and add the team as a reviewer for awareness.
- Fill in every section of the PR template before requesting review
- Link the Linear or Jira ticket using the ticket URL or keyword (Closes VAN-123)
- Assign 1-2 specific reviewers who are familiar with the affected code area
Merge the PR and clean up the branch
After approval and passing CI checks, merge the PR using squash merge (for a clean main history) or merge commit (to preserve individual commits). Enable 'Automatically delete head branches' in your repository settings so merged branches are cleaned up automatically. After merging, switch back to main and pull the latest changes before starting your next feature branch.
- Choose squash merge for feature branches to keep the main branch history clean
- Enable automatic branch deletion in repository settings to avoid stale branch accumulation
- Pull main after merging and start your next branch from the updated main
Common mistakes
Making feature branches too long-lived
A branch that diverges from main for three weeks accumulates massive merge conflicts and is extremely difficult to review. Keep feature branches to 1-3 days of work. If a feature takes longer, break it into smaller branches that merge incrementally behind a feature flag.
Not rebasing or updating before merging
Merging a branch that is two weeks behind main can introduce subtle conflicts that pass CI but break at runtime. Always update your branch with the latest main (rebase or merge main into your branch) before requesting final review.
Skipping code review for small changes
Even a one-line fix can introduce a bug, and the review process catches more than just code errors — it ensures knowledge sharing and consistency. Require reviews on all PRs regardless of size.
Using inconsistent branch naming
When branches have random names like 'johns-fix', 'new-thing', and 'WIP-stuff', it is impossible to understand what is in flight. Enforce the naming convention through team culture and optionally with a CI check that validates branch names.
Tips
Use GitHub's CODEOWNERS file to automatically assign reviewers based on which files the PR modifies — this ensures the right domain experts review each change
Enable 'Require conversation resolution before merging' so review comments cannot be ignored — every comment must be explicitly resolved
Use draft PRs to get early feedback on your approach before investing time in polishing the implementation
Set up a branch naming validator in your CI pipeline that fails PRs from branches that do not follow your naming convention
How Vantage helps
When Vantage pushes tickets to Linear, engineers can create feature branches linked directly to their assigned tickets. This traceability from product requirement through ticket to code branch ensures that every line of code ties back to a documented product decision.