Git Branch
Guide for managing version control branching strategies following the Conventional Branch specification.
When to Use This Skill
- Creating new feature, bugfix, or maintenance branches
- Ensuring branch names follow project standards
- Managing branch lifecycle and organization
- Integrating issue tracker IDs into branch names
Branching Strategy
Follow the Conventional Branch specification for consistent and descriptive branch naming.
Structure
The branch structure follows a categorized format:
<type>/<description>
Types (<type>)
main: The primary development branch (e.g.,main,master, ordevelop).feat/: For new features (e.g.,feat/add-login-page).fix/: For bug fixes (e.g.,fix/header-bug).hotfix/: For urgent production fixes (e.g.,hotfix/security-patch).release/: For preparing a new release (e.g.,release/v1.2.0).chore/: For non-code tasks like dependencies or documentation updates (e.g.,chore/update-dependencies).
Naming Rules
- Character Set: Use lowercase alphanumerics (
a-z,0-9), hyphens (-), and dots (.). - Separators: Use hyphens to separate words in the description. Dots are permitted in
release/branches for versioning. - Restrictions:
- Avoid special characters, underscores, or spaces.
- No consecutive hyphens or dots (e.g., avoid
new--login). - No leading or trailing hyphens/dots in the description.
- Conciseness: Keep names descriptive yet brief.
- Ticket Integration: Include project management ticket numbers if applicable (e.g.,
feat/issue-123-new-login).
Workflow
- Start from the default branch.
- Ensure the local branch is up-to-date:
git pull origin $(git branch --show-current). - Create the new branch without tracking:
git checkout --no-track -b <type>/<description>.
Additional Resources
Reference Files
For detailed patterns and advanced git workflows, consult:
references/branching-workflows.md- Advanced branching and merging strategies.