Implementing feature branch workflows in GitHub

Greg Foster
Greg Foster
Graphite software engineer
Try Graphite


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Table of contents

A feature branch workflow keeps your main branch clean and stable by isolating development work into dedicated branches. This prevents broken code from entering production and makes continuous integration and code review straightforward. You get:

  • Parallel team development without interference.
  • Improved code quality via pull requests.
  • Easier rollback and debugging.
Terminal
git checkout main
git pull origin main
git checkout -b feature/ISSUE-123-add-login

Use a clear naming convention: prefix with feature/, bugfix/, etc.

Make small, descriptive commits (e.g., "add login form UI") to simplify review and troubleshooting.

Terminal
git push -u origin feature/ISSUE-123-add-login

This lets teammates see progress and creates a backup.

Regularly update your branch to avoid conflicts:

Terminal
git checkout feature/ISSUE-123-add-login
git pull origin main

Or use rebase to keep a cleaner history.

On GitHub, open a PR from your feature branch into main. Use descriptive title, link related issues, and include context in the description.

Team members review via GitHub's UI. Address comments by committing updates to the same branch. GitHub auto-updates the PR.

Once approved and tests pass (CI/CD), merge—preferably via "Squash and merge" for tidy history. Delete the feature branch afterward.

  1. Short-lived branches – merge early to reduce conflicts.
  2. Scope‑small changes – avoid bloated or multi‑purpose branches.
  3. Clear naming convention – use issue numbers and consistent prefixes.
  4. Keep branches synced – merge or rebase regularly to main.
  5. Use feature flags – deploy incomplete code safely, turned off until ready.
  6. Commit quality – small, targeted commits with meaningful messages.
  7. Automate checks via CI – on PR creation, trigger tests, linters, and coverage tools.

The GitHub feature branch setup fosters modular, reviewable, and stable development flow:

  • Isolate each feature/bugfix
  • Continuously commit and push
  • Sync with main
  • Open pull requests
  • Review, iterate, merge
  • Delete branches post‑merge

This branch workflow enhances collaboration, continuous integration, and production readiness.

Implementing feature branch workflows in GitHub boosts developer productivity and code quality. Studies show that disciplined branch workflows and normalized build/test cycles correlate with more merged PRs and fewer bugs. Your team moves faster and safer.

StepCommand / action
Clone repogit clone / git checkout main
Branchgit checkout -b feature/...
Commitgit add, git commit -m "..."
Pushgit push -u origin feature/...
Syncgit merge origin/main or rebase
Open PROpen on GitHub, add reviewers, link issue
ReviewAddress feedback with commits
Merge"Squash and merge"; delete branch
Run CIEnsure tests pass before merging

You can elevate your feature branch setup by layering in Graphite's stacked-branch capabilities. Instead of juggling separate feature branches and manually rebasing when dependencies shift, Graphite lets you create and manage stacked branches (e.g., gt branch create feature/a, then gt branch create feature/b --parent feature/a), automatically rebases child branches when a parent merges or updates via commands like gt repo sync --restack, and submits each layer as its own pull request—streamlining reviews, reducing merge conflicts, and keeping your feature branch workflows github clean, modular, and scalable.

By following this guide, you'll master how to implement feature branches and embrace feature branch best practices on GitHub to maintain quality, clarity, and collaboration across your team.

Built for the world's fastest engineering teams, now available for everyone