Skip to main content

Which branch are feature branches created from?

Usually feature branches are created from the main development branch, meaning the branch that holds the current stable code intended for further work.

In most cases this is:

  • main, the most common option
  • develop, if Gitflow is used

The most common option (Feature Branch Workflow)

In Feature Branch Workflow, feature branches are created from main:

bash
git checkout main git checkout -b feature/login

Why from main:

  • it holds stable, current code
  • all new features start from the same state
  • it is easier to merge back later

If Gitflow is used

In Gitflow, feature branches are created from develop, not from main:

  • main is production
  • develop is active development
bash
git checkout develop git checkout -b feature/login

General rule (important for an interview)

Feature branches are created from the branch they will later be merged into.

  • merging into main → create from main
  • merging into develop → create from develop

What you should not do

do not create a feature branch from another feature branch do not start a feature from an outdated branch do not mix several tasks in one branch


Short answer for an interview

Usually feature branches are created from the main development branch: from main in Feature Branch Workflow or from develop in Gitflow, that is, from the branch the changes will be merged into.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.