Git branching strategy refers to the methodologies and practices that a development team uses to manage and organize branches within a Git repository.
A branching strategy defines how and when branches are created, how they are used, and how they are merged back into the default branch. This can include guidelines for naming branches, code review procedures, and testing and deployment processes.
The goal of a branching strategy is to provide a structured and efficient workflow for the development team, while also ensuring that the codebase is stable and maintainable.
Our remote development team will use the following Git branching strategy:
Work done in the feature branch
main
branch.Pull request created for a feature branch
main
branch. Read about naming convention for a git branch in a next section.Code review of a pull request
main
branch. main
branch.(Optional) Review feature branch in a dynamic environment
Pull request is merged into main
main
branch continuously deployed to lower test environments for further testing, validation and review.There are several conventions that can be used when naming Git branches. Some common practices include:
Using descriptive and meaningful names: Branch names should clearly indicate the feature or bug fix they are associated with. For example, feature/login-page
or fix/user-profile-bug
.
Using dashes or underscores to separate words: This makes the branch name more readable and easy to understand.
Using prefixes to indicate the type of branch: Some teams use prefixes like feature/
, fix/
, hotfix/
, etc. to indicate the type of branch.
Using issue numbers: include the issue number in the branch name to make it easy to track what the branch is associated with.
Consistency: It is important to be consistent in how branch names are constructed and formatted. This helps to ensure that the branch names are easy to understand, and that everyone on the team is using the same naming conventions.
Avoiding special characters: Avoid using special characters like spaces, commas, and exclamation marks in branch names as they can cause issues when working with the command line.
Ultimately, the most important thing is to choose a branch name that is easy to understand, consistent, and makes it easy to track the branch's purpose from a single look.