| name | git-workflow |
| description | Branch management, PR creation, rebase, and merge workflows. Use when the user asks to create a branch, open a PR, rebase, squash, cherry-pick, or manage git workflow steps. |
| version | 1.0.0 |
| task_type | git |
Git Workflow
Automates multi-step git operations so you execute them in one shot instead of sequencing individual commands.
Rules
- Always run commands, never just print them.
- Follow Conventional Commits for all commit messages.
- Use the repo's PR template (
.github/pull_request_template.md) when creating PRs.
- Push directly without asking for confirmation.
- Force-push to existing branches to update PRs in place.
- Never close PRs unless explicitly told to.
Procedures
Create feature branch and start work
git checkout main && git pull --rebase origin main
git checkout -b <type>/<short-description>
Open a PR
git push -u origin HEAD
gh pr create --fill --title "<type>(scope): description" --body-file .github/pull_request_template.md
If no template exists, use --fill only.
Rebase on main
git fetch origin main
git rebase origin/main
git rebase --continue
git push --force-with-lease
Squash branch into single commit
git reset --soft origin/main
git commit -m "<type>(scope): description"
git push --force-with-lease
Update PR (amend + force push)
git add -A
git commit --amend --no-edit
git push --force-with-lease
Cherry-pick a commit to another branch
git checkout <target-branch>
git cherry-pick <commit-sha>
git push
Clean up merged branches
git checkout main && git pull
git branch --merged main | grep -v "main\|master\|\*" | xargs -r git branch -d
Stash and switch context
git stash push -m "wip: <context>"
git checkout <other-branch>
git checkout <original-branch>
git stash pop
PR Creation Checklist
- Check for
.github/pull_request_template.md
- Fill every section of the template
- Use conventional commit style for the PR title
- Push and create in one flow
- Do not leave inline review comments