Skip to content

Git Branches Management

Banghua Zhao edited this page Mar 1, 2024 · 4 revisions

Branch Category

  • master (main): The default master branch. Source of Truth
  • develop: Branch for developing new features. Created from master.
  • task: Branch for developing new features. Created from develop. Merge into develop once finished.
  • bug: Branch for fixing bugs. Created from develop. Merge into develop once finished.
  • release: Branch for releasing a new version. Created from develop. Merge into master after regression test is done.

Note that release is only created during the release process by the release captain.

Branching Naming

If we have a project tracking system like JIRA, the naming format is:

  • For a task/bug branch: {Branch Category}/{JIRA Ticket Number}/snake-case-name. For example: task/VABS-1234-ticket-description
  • For a release branch: release/vMajor.Minor.Patch: For example: release/v2.1.1

If we don't have a project tracking system, the naming format for task/bug is simpler:

  • For a task/bug branch: {Branch Category}/snake-case-name. For example: task/description

Note that some conventions use name prefixes for each feature (task/bug) name. For example: bz/task/VABS-1234-ticket-desciption. The benefit is that it is easier to identify the developer for a large team. I think we don't need to do it at this stage.

Branches Management

  • For developing new features or fixing bugs:
    • Create a local task/description or bug/description branch from develop
    • Finish the development on the local branch.
    • Push the local branch to the remote
    • Create a new pull request (merge request) to develop
    • No conflict, pass CI, get approval from code review
    • Merge the branch to develop (MR Option: Delete, Squash)
  • For releasing a new version:
    • Create a new task/prepare-[major].[minor] branch from develop
    • Update the version to [major].[minor] (and other update like l10n)
    • Merge task/prepare-[major].[minor] against the develop branch
    • Once develop branch is prepared (task/prepare-[major].[minor] has been merged into the develop branch), push a release branch following 'release/[major].[minor]' format
    • MR new release branch again the master branch (MR Option: Delete, No Squash)
    • Create a release in GitHub with a new tag (the tag number is the name as the release version number)
Clone this wiki locally