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 againstdevelop. Following approval and code review, the branch is merged and subsequently deleted. Regular rebasing ontodevelopis required. - urgent-fix/identifier - Hotfix Branch
Spawned from eithermainordevelopto 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-module2. 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 occurPush the local feature branch to the remote server. The -u flag establishes a tracking relationship, simplifying future pushes.
git push -u origin feat/new-moduleCommit Message Guidelines
Prefix commit messages with the following identifiers to categorize changes:
feat: New capabilityfix: Bug resolutiondocs: Documentation updatesstyle: Formatting adjustments without logic changesrefactor: Code restructuring without feature additions or bug fixesperf: Performance enhancementstest: Test additions or correctionschore: Build system or auxiliary tooling modificationsrevert: Reverting previous commitsmerge: Branch integrationssync: 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 develop4. 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 develop5. 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