Agent skill
git-workflow-guide
Guide Git branching strategies, branch naming, and merge operations. Use when: creating branches, merging, pull requests, Git workflow questions. Keywords: branch, merge, PR, pull request, GitFlow, GitHub Flow, 分支, 合併, 工作流程.
Install this agent skill to your Project
npx add-skill https://github.com/AsiaOstrich/universal-dev-skills/tree/main/skills/git-workflow-guide
SKILL.md
Git Workflow Guide
This skill provides guidance on Git branching strategies, branch naming conventions, and merge operations.
Quick Reference
Workflow Strategy Selection
| Deployment Frequency | Recommended Strategy |
|---|---|
| Multiple times/day | Trunk-Based Development |
| Weekly to bi-weekly | GitHub Flow |
| Monthly or longer | GitFlow |
Branch Naming Convention
<type>/<short-description>
| Type | Usage | Example |
|---|---|---|
feature/ |
New functionality | feature/oauth-login |
fix/ or bugfix/ |
Bug fixes | fix/memory-leak |
hotfix/ |
Urgent production fixes | hotfix/security-patch |
refactor/ |
Code refactoring | refactor/extract-service |
docs/ |
Documentation only | docs/api-reference |
test/ |
Test additions | test/integration-tests |
chore/ |
Maintenance tasks | chore/update-dependencies |
release/ |
Release preparation | release/v1.2.0 |
Naming Rules
- Use lowercase | 使用小寫
- Use hyphens for spaces | 使用連字號分隔單詞
- Be descriptive but concise | 具描述性但簡潔
Detailed Guidelines
For complete standards, see:
- Git Workflow Strategies
- Branch Naming Reference
Pre-branch Checklist
Before creating a new branch:
-
Check for unmerged branches
bashgit branch --no-merged main -
Sync latest code
bashgit checkout main git pull origin main -
Verify tests pass
bashnpm test # or your project's test command -
Create branch with proper naming
bashgit checkout -b feature/description
Merge Strategy Quick Guide
| Strategy | When to Use |
|---|---|
Merge Commit (--no-ff) |
Long-lived features, GitFlow releases |
| Squash Merge | Feature branches, clean history |
| Rebase + FF | Trunk-Based, short-lived branches |
Examples
Creating a Feature Branch
# Good
git checkout -b feature/user-authentication
git checkout -b fix/null-pointer-in-payment
git checkout -b hotfix/critical-data-loss
# Bad
git checkout -b 123 # Not descriptive
git checkout -b Fix-Bug # Not lowercase
git checkout -b myFeature # No type prefix
Merge Workflow (GitHub Flow)
# 1. Create branch from main
git checkout main
git pull origin main
git checkout -b feature/user-profile
# 2. Make changes and commit
git add .
git commit -m "feat(profile): add avatar upload"
git push -u origin feature/user-profile
# 3. Create PR and merge via GitHub/GitLab UI
# 4. Delete branch after merge
git checkout main
git pull origin main
git branch -d feature/user-profile
Handling Merge Conflicts
# 1. Update your branch with main
git checkout feature/my-feature
git fetch origin
git merge origin/main
# 2. Resolve conflicts in files
# <<<<<<< HEAD
# Your changes
# =======
# Incoming changes
# >>>>>>> origin/main
# 3. Stage resolved files
git add resolved-file.js
# 4. Complete merge
git commit -m "chore: resolve merge conflicts with main"
# 5. Test and push
npm test
git push origin feature/my-feature
Configuration Detection
This skill supports project-specific workflow configuration.
Detection Order
- Check
CONTRIBUTING.mdfor "Git Workflow" or "Branching Strategy" section - If found, use the specified strategy (GitFlow / GitHub Flow / Trunk-Based)
- If not found, default to GitHub Flow for simplicity
First-Time Setup
If no configuration found:
- Ask the user: "This project hasn't configured a Git workflow strategy. Which would you prefer? (GitFlow / GitHub Flow / Trunk-Based)"
- After selection, suggest documenting in
CONTRIBUTING.md:
## Git Workflow
### Branching Strategy
This project uses **[chosen option]**.
### Branch Naming
Format: `<type>/<description>`
Example: `feature/oauth-login`, `fix/memory-leak`
### Merge Strategy
- Feature branches: **[Squash / Merge commit / Rebase]**
License: CC BY 4.0 | Source: universal-dev-standards
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ai-collaboration-standards
Prevent AI hallucination and ensure evidence-based responses when analyzing code or making suggestions. Use when: analyzing code, making recommendations, providing options, or when user asks about confidence/certainty. Keywords: certainty, assumption, inference, evidence, source, 確定性, 推測, 假設, 來源, 證據.
release-standards
Semantic versioning and changelog formatting for software releases. Use when: preparing releases, updating version numbers, writing changelogs. Keywords: version, release, changelog, semver, major, minor, patch, 版本, 發布, 變更日誌.
requirement-assistant
Guide requirement writing, user story creation, and feature specification. Use when: writing requirements, user stories, issues, feature planning. Keywords: requirement, user story, issue, feature, specification, 需求, 功能規劃, 規格.
testing-guide
Testing pyramid and test writing standards for UT/IT/ST/E2E. Use when: writing tests, discussing test coverage, test strategy, or test naming. Keywords: test, unit, integration, e2e, coverage, mock, 測試, 單元, 整合, 端對端.
documentation-guide
Guide documentation structure, README content, and project documentation best practices. Use when: creating README, documentation, docs folder, project setup. Keywords: README, docs, documentation, CONTRIBUTING, CHANGELOG, 文件, 說明文件.
commit-standards
Format commit messages following conventional commits standard. Use when: writing commit messages, git commit, reviewing commit history. Keywords: commit, git, message, conventional, 提交, 訊息, feat, fix, refactor.
Didn't find tool you were looking for?