GitFlow Workflow
Use this skill to apply the repository GitFlow policy end-to-end with safe defaults.
Primary policy source:
- •
.cursor/rules/share/gitflow-branch-policy.mdc
When To Use
- •User wants to start a new branch.
- •User asks how to commit under team standards.
- •User wants to sync a feature branch with
develop. - •User is preparing a PR.
- •User wants to integrate feature/bugfix into
develop. - •User needs safe push/rebase guidance.
Workflow
1) Inspect current state first
Always start with:
git status git branch --show-current
If user is on main or develop and wants to develop features, warn and move to feature flow.
2) Start new feature/bugfix from develop
git checkout develop git pull origin develop git checkout -b feature/<short-name> develop
For bug work in development:
git checkout develop git pull origin develop git checkout -b bugfix/<short-name> develop
3) Commit using convention
Preferred format:
type(scope): description
Examples:
- •
feat(auth): add google oauth login flow - •
fix(api): handle empty vehicle filter response - •
docs(gitflow): clarify merge target policy
4) Sync branch before PR (mandatory)
git checkout feature/<name> git fetch origin git merge origin/develop # or rebase if explicitly desired: # git rebase origin/develop
If conflicts happen:
- •Resolve files
- •
git add <file> - •Continue:
- •
git merge --continueor - •
git rebase --continue
- •
5) Push safely
Default push:
git push -u origin feature/<name>
If branch was rebased:
git push --force-with-lease origin feature/<name>
Never recommend plain --force.
6) Create PR to develop (mandatory for integration)
git checkout feature/<name> git push -u origin feature/<name> gh pr create --base develop --head feature/<name> --title "<title>" --body "<body>"
If branch was already pushed, skip the push line and only create PR.
7) PR readiness checklist
- •Branch is not
main/develop - •Branch synced with
origin/develop - •Conflicts resolved
- •Relevant tests/build pass
- •Commit messages follow convention
- •Merge target is
develop - •Do not recommend local direct merge into
develop
8) Post-merge cleanup
git checkout develop git pull origin develop git branch -d feature/<name> git push origin --delete feature/<name>
Safety Guardrails
- •Never suggest direct commit on
mainordevelop. - •Never suggest local direct merge to move feature/bugfix into
develop. - •Always show target and source explicitly for merge actions.
- •For uncertain intent, ask one clarifying question before risky git commands.
- •Prefer minimal, reversible steps.
Response Template
When user asks for GitFlow help, respond with:
- •Current-state check commands
- •Sync/push command block
- •PR creation command block (target:
develop) - •Short reason for safety
- •Optional cleanup step after PR merge
Additional Examples
See examples.md for common scenarios.