-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Feature Branch Workflow
Feature branches are simply a branch for feature that is being actively developed but not yet merged into main. The reason for feature branches is mainly to avoid large PRs.
Generally, the decision to create a feature branch will be left to individual contributors. However, a contributor should keep the following key points in mind:
- The aim of a PR introducing a new feature is to have that feature be complete in its MVP format
- Work is still based on tickets, not complete features
- No incomplete ticket should be merged into
main - If multiple tickets should be grouped together to avoid merging incomplete features, they should be grouped together under a feature branch
- If a ticket requires a large amount of work that would result in a large PR, the ticket should be completed under a feature branch with multiple PRs made to that
Terminology: "Incomplete Feature"
We define an incomplete feature as a chunk of code that introduces impactful work that doesn't function. A great example of this is UI without logic. UI without business logic should not be merged into
main, especially if it appears for users.
For this example, we will use
workingfor the branch in which your code changes exist,featureas the feature branch, andmainas Mozilla Firefox iOSsmainbranch.
Feature branch spinoff process:
- If you're starting work on a ticket and know that it requires a feature branch
- create a
featurebranch offmain, and then make aworkingbranch offfeature
- create a
- If you already have a
workingbranch and realize it should be a feature branch- make sure your
workingbranch up to date withmaineither through a rebase or a merge. This is to prevent conflicts down the line - create a
featurebranch offmain
- make sure your
In either case, both feature and working branches should be pushed to your fork.
working PRs
- All
workingbranches that are ready for review should make a PR againstfeature - Request the appropriate reviewers
- Once a PR is approved, you may merge it and continue working
feature PRs
- Once all work on a
featurebranch is complete and ready formain, make a PR forfeaturefrom your fork tomain - PR's name should follow PR Naming Guide
- PR's description should include an explanation of the feature
- Only tag reviewers that have already reviewed the PRs of that branch
- They will automatically approve the PR as it's assumed that everything in the feature branch will have already been reviewed
- Once BR and other tests pass, you may merge the branch