CodeBlanks Logo Icon CodeBlanks

Branch strategy

Create a feature branch with a naming convention.

Feature branch strategy

In the feature branch strategy, a separate branch is created for each new feature or task. This allows development to proceed independently of the main branch and be reviewed when completed. Using the feature/ prefix in branch names provides consistent naming across the team.

feature/user-login
feature/payment-page
feature/search-filter

Branch naming conventions

Branch names should be short, descriptive, and consistent. Using lowercase letters and separating words with hyphens improves readability. For example, feature/user-login can be used for user login development.

git switch -c feature/user-login
git branch

Practice Create and list a feature branch

Create a new branch named feature/dashboard and switch to it. Then list the existing branches. Write the two commands in the correct order.

Starter code

terminal
# Yeni özellik dalını oluştur

# Dalları listele

Sample solution

terminal
git switch -c feature/dashboard
git branch

Expected output

Switched to a new branch 'feature/dashboard'
* feature/dashboard
  main

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which branch name follows this strategy for developing a new user profile feature?

  • main
  • feature/user-profile Correct answer
  • origin
  • HEAD

Explanation: The feature/ prefix indicates that the branch was created to develop a new feature.

2 Create a feature branch

Question
git switch -c ____
Answer
git switch -c feature/search-filter

Explanation: git switch -c creates a new branch and switches to it.

3 Branch naming components

Term Meaning
feature/ New feature prefix
user-login Short feature name
Tire (-) Separates words
Küçük harf Provides consistent casing

All lessons in Intermediate

20 Intermediate final

  1. Branch management
  2. Rebase
  3. Conflict
  4. PR flow