Feature Branch — is a Git branching technique where each new feature is developed in a separate branch, isolated from the main codebase. This allows multiple developers to work on different tasks simultaneously without risking the stable version of the project. According to Atlassian, 2024, Feature Branch is a key element of Git Flow and is used in most commercial projects.
Key Takeaways
feature/function-name in standard Git Flow.Feature Branch is a temporary Git branch created from develop to work on a specific functionality. Unlike the long-lived main and develop branches, feature branches exist for a limited time — from a few hours to a few weeks.
The main purpose of a feature branch is to isolate changes related to one task from the rest of the codebase. A developer can experiment, make many commits, and even break code in their own branch without affecting other team members.
After development is complete, the feature branch is merged back into develop via a Pull Request with mandatory code review. After merging, the branch is typically deleted to keep the repository clean.
According to Vincent Driessen, 2010, the Git Flow model with feature branches became an industry standard thanks to its clear separation of responsibilities between different branch types.
The workflow with feature branches consists of a sequence of steps that a developer performs for each new feature. This process minimizes merge conflicts and ensures code quality control.
Periodic synchronization with develop is critically important. The longer a feature branch lives without merging changes from develop, the higher the likelihood of conflicts during the final merge.
| Sync Frequency | Conflict Risk | Development Convenience |
|---|---|---|
| Daily | Low | Requires frequent rebase or merge |
| Weekly | Medium | Comfortable pace, moderate conflicts |
| Monthly | High | Risk of complex merge conflict resolution |
| Never | Critical | Merge may be impossible without data loss |
Branch naming is an important part of team discipline. A consistent naming standard allows everyone to quickly identify which task is being worked on and who is doing it.
feature/added-auth-module.feature/PROJ-42-add-login.feature/feat/analytics-dashboard.Using a task ID from JIRA, Trello, or another system is a best practice. It automatically links code to the task and simplifies branch search via git log.
Pull Request (or Merge Request in GitLab) is a request to merge a feature branch into develop. A PR is not just a technical operation, but a team code review process that improves code quality and spreads knowledge within the team.
A good PR contains a title with a brief task description, a link to the ticket, and a description of changes. The developer should state what was done, which files were changed, and whether there are potential risks for other parts of the project.
The team reviews the code in the PR, leaves comments, requests changes, and approves the merge. After approval, a merge or squash merge is performed.
The average PR review time in mobile development ranges from 4 to 24 hours. The Danger library automates some checks by running linters and tests directly in the PR.
After PR approval, the feature branch can be merged into develop in various ways. The choice of merge strategy affects the commit history and the ability to roll back changes.
For mobile projects with frequent releases, squash merge is most commonly used: it provides a clean history in develop, while development details remain in the PR description and the tracker task.
Even experienced developers make mistakes when working with feature branches. Knowing common problems helps avoid wasted time and data loss.
The best way to avoid these issues is to agree on work rules at the start of the project and use automated checks in the CI/CD pipeline.
Let’s consider a practical scenario: a developer starts a new authentication feature for a mobile app. They create a feature branch, work on the code, and complete the task with a Pull Request.
# Update develop and create feature branch
git checkout develop
git pull origin develop
git checkout -b feature/add-login-screen
# Working on the feature: commits
git add src/ui/login/
git commit -m "Add login screen layout"
# Push feature branch to remote
git push origin feature/add-login-screen
# Synchronize with develop (rebase)
git fetch origin develop
git rebase origin/develop
# After PR approval: update local develop and delete branch
git checkout develop
git pull origin develop
git branch -d feature/add-login-screen
The git branch -d command deletes a branch only after its changes have been fully merged. If the branch is not merged, Git will suggest using git branch -D for force deletion — use this flag with caution.
A CI/CD pipeline should run for every feature branch before creating a PR. This helps detect issues early, before the code reaches other developers for review.
# GitHub Actions for checking feature branch
name: Feature Branch CI
on:
push:
branches:
- 'feature/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: ./gradlew test
- name: Lint check
run: ./gradlew lint
The pipeline verifies that the code compiles, tests pass, and code style meets team standards. Only after passing all checks can a Pull Request be created.
Frequently Asked Questions
Yes, this is standard practice. Each developer can work on their own feature branch, and all of them synchronize with develop independently. The main rule is one branch per task to avoid cross-task dependencies in the code.
Run git rebase origin/develop on your feature branch. If conflicts arise, resolve them one by one — commits will be rewritten on top of the latest develop state. After rebase, you will need git push --force to update the remote branch.
If a task is cancelled, simply delete the feature branch. Run git branch -d feature/name for the local branch and git push origin --delete feature/name for the remote one. All uncommitted changes will be lost.
They are essentially the same. Different teams use different prefixes: feature/, task/, feat/. There is no difference in Git mechanics — they are all temporary branches created from develop for isolated development.
Yes, this is a mandatory practice. Branches left after merging clutter the references list and can cause confusion. Most platforms (GitHub, GitLab) offer to delete the branch immediately after merging a PR, and local branches can be deleted with the git branch -d command.
Summary
We will develop a mobile application turnkey
IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.
Read also