Collaborative Git Branching Strategy and Workflow

Branch Architecture

  • main - Production Branch
    All official releases are tagged and published here. Direct commits are strictly forbidden.
  • develop - Integration Branch
    Serves as the primary hub for daily development and internal testing. Direct pushes are disabled; integration occurs exclusively through Pull Requests (PRs). Developers must frequently sync their local repositories with this branch.
  • feat/identifier - Feature Branch
    Isolated environments for building specific functionalities (e.g., feat/shopping-cart). Developers can push directly to these branches. Upon completion, a PR must be opened against develop. Following approval and code review, the branch is merged and subsequently deleted. Regular rebasing onto develop is required.
  • urgent-fix/identifier - Hotfix Branch
    Spawned from either main or develop to address critical production defects. They follow the same PR, review, and deletion lifecycle as feature branches.

Operational Workflow

Initial repository setup targeting the integration branch:

git clone -b develop <repo_url>

1. Branch Initialization

Always isolate new work in a dedicated branch. Synchronize your local environment before creating it.

git switch develop
git pull origin develop
git switch -c feat/new-module

2. Committing Changes

Stage and snapshot your modifications using standardized messages.

git add .
git commit -m "feat: implement user authentication"

Prior to pushing, ensure your branch incorporates the latest upstream changes to avoid conflicts.

git switch develop
git pull --rebase
git switch feat/new-module
git rebase -i develop
# Address any merge conflicts if they occur

Push the local feature branch to the remote server. The -u flag establishes a tracking relationship, simplifying future pushes.

git push -u origin feat/new-module

Commit Message Guidelines

Prefix commit messages with the following identifiers to categorize changes:

  • feat: New capability
  • fix: Bug resolution
  • docs: Documentation updates
  • style: Formatting adjustments without logic changes
  • refactor: Code restructuring without feature additions or bug fixes
  • perf: Performance enhancements
  • test: Test additions or corrections
  • chore: Build system or auxiliary tooling modifications
  • revert: Reverting previous commits
  • merge: Branch integrations
  • sync: Synchronizing upstream bug fixes

To modify a recent commit message, execute:

git commit --amend -m "Updated commit description"

3. Continuous Integration Syncing

Maintain alignment with the main development line throughout your workflow.

git switch develop
git pull
git switch feat/new-module
git rebase develop

4. Pull Request Submission

After completing the feature, perform a final synchronization, push the finalized code, and initiate a PR for code review.

# Execute final sync (Step 3)
git push origin feat/new-module
# Utilize the Git hosting platform UI to open a PR targeting develop

5. Branch Cleanup

Discard local and remote remnants of merged branches to maintain repository hygiene.

git switch develop
git push origin --delete feat/new-module
git branch -d feat/new-module

Tags: Git Version Control Workflow Branching Strategy Collaboration

Posted on Wed, 13 May 2026 19:45:51 +0000 by stirton