Git Branching Strategy

Yubin Karki
1 min readJul 28, 2023

--

Git feature branch workflow.

The idea behind this branching strategy is that any feature to be worked on should be done on a feature branch that is checked out from the default branch.

Do not work on the default branch or push directly to it.

// Assuming you're on develop branch.

git pull origin develop
git checkout feat/google-auth

// Perform your changes in the new branch.

git pull origin develop // Resolve merge conflicts if any.
git push origin feat/google-auth

// Proceed to create a PR from remote.
feature_branch.png

Branch Naming Conventions

A git branch should start with the type of work that branch is related to. Normally used prefixes are:

  • feat ➡ For adding, refactoring or removing a feature.
  • fix ➡ For fixing a bug.
  • hotfix ➡ Temporary bug fix on a live app.
  • refactor ➡ When moving or renaming files/folders.
  • style ➡ Affecting styles only.
  • docs ➡ Changes reflecting on documents.
  • chore ➡ Anything that is not a feature or a fix and does not have it’s specific tag.
Examples:

feat/profile-design
feat/list-animation
fix/null-data-return
fix/card-overlay-effect
hotfix/data-not-updating
style/update-card-gradient
chore/use-arrow-function

Git commit messages can also be prefixed with these tags.

--

--