What is the essence of the Feature Branch Workflow?
Feature Branch Workflow is a Git workflow in which every new task (a feature, a bug fix, an improvement) is developed in a separate branch, while the main branch always stays stable.
Put simply: "One task, one branch".
The essence of Feature Branch Workflow
The main idea:
main(ormaster) - the stable code- a separate feature branch is created for each task
- development happens only in feature branches
- code reaches
mainthrough a Pull Request
The typical workflow
- Create a branch from
main
bash
git checkout -b feature/login- Work on the task and make commits
bash
git commit- Push the branch to the remote repository
bash
git push origin feature/login- Open a Pull Request into
main
- it goes through code review
- tests / CI run
- Merge the changes into
main - Delete the feature branch
Why this workflow is so popular
Task isolation
- each feature is developed separately
- changes do not interfere with others
- you can experiment safely
Safety of the main branch
mainis always in a working state- you cannot accidentally break production
Convenient code review
- all the code for a task is gathered in one Pull Request
- it is easy to see what changed and why
Scales well
- works for small and large teams
- easy to add rules: CI, approvals, linters
Merge or rebase in Feature Branch Workflow
Usually:
- merge is done through a Pull Request
- rebase is used locally to update a feature branch
Important:
mainis never rebased
Pros and cons
Pros
- simple and clear
- safe
- works great with Pull Requests
- a de facto industry standard
Cons
- many branches appear
- without discipline, feature branches can live too long
- the history may contain merge commits
Short answer for an interview
Feature Branch Workflow is an approach where each task is developed in a separate branch, and changes reach the main branch only through a Pull Request, which ensures isolation, review, and stability.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.