-
Notifications
You must be signed in to change notification settings - Fork 3k
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
working
for the branch in which your code changes exist,feature
as the feature branch, andmain
as Mozilla Firefox iOSsmain
branch.
Feature branch spinoff process:
- If you're starting work on a ticket and know that it requires a feature branch
- create a
feature
branch offmain
, and then make aworking
branch offfeature
- create a
- If you already have a
working
branch and realize it should be a feature branch- make sure your
working
branch up to date withmain
either through a rebase or a merge. This is to prevent conflicts down the line - create a
feature
branch offmain
- make sure your
In either case, both feature
and working
branches should be pushed to your fork.
working
PRs
- All
working
branches 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
feature
branch is complete and ready formain
, make a PR forfeature
from 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