Git workflow commands: commit, branch, pr, push, sync, review, fixup, update-pr, commit-push, clean-gone, status, merge. Use with command argument.
Unified git workflow commands for commits, branches, PRs, and reviews.
Invoke with a command name as argument:
Skill({ skill: "git-workflow", args: "commit" })$git-workflow commit or /skills git-workflow commit| Command | Description |
|---------|-------------|
| commit | Create conventional commit with all changes staged |
| branch | Create feature branch with naming convention |
| pr | Create pull request with smart template |
| push | Push commits to remote safely |
| sync | Sync branch with main via merge or rebase |
| review | Run comprehensive code review |
| fixup | Fix PR review comments and CI failures |
| update-pr | Update PR title and body from commits |
| commit-push | Create conventional commit and push |
| clean-gone | Remove local branches deleted from remote |
| status | Full PR dashboard: CI, reviews, threads, mergeable |
| merge | Merge PR after readiness check |
Create a conventional commit with all current changes staged.
In multi-agent and human-in-the-loop workflows, all changes should be committed unless they are clearly cruft. Do not be overly selective.
! git status --short
! git diff --stat
! git diff --cached --stat
! git log --oneline -5
git add -A (stage everything)type(scope): short description
- Bullet point explaining what changed
- Another bullet point if needed
| Type | When to Use |
|------|-------------|
| feat | New feature |
| fix | Bug fix |
| refactor | Code restructuring without behavior change |
| docs | Documentation only |
| test | Adding or updating tests |
| chore | Build, CI, dependencies |
| perf | Performance improvement |
# Stage all changes
git add -A
# Check for sensitive files
git diff --cached --name-only | grep -E '\.(env|pem|key)$|credentials|secret'
# Commit with heredoc for multi-line
git commit -m "$(cat <<'EOF'
feat(auth): add login endpoint
- Added POST /api/auth/login
- Created AuthService with password verification
- Added unit tests for authentication flow
EOF
)"
# Single-line for trivial changes
git commit -m "fix(typo): correct spelling in README"
If sensitive files are staged, unstage them:
git reset HEAD <sensitive-file>
Then re-run the commit.
Banned:
Required:
type(scope): descriptiongit add -Atype(scope): description formatgit add -ACreate a new branch using worktrunk (wt switch), falling back to git if wt is unavailable.
! git branch --show-current
! command -v wt && wt status 2>/dev/null || echo "wt not available"
! git branch --list | head -10
description: Brief description (converted to kebab-case slug, max 30 chars)wt switch -c ${SLUG} --base mainwt unavailable: git fetch origin main && git checkout -b ${SLUG} origin/main# Using worktrunk (preferred)
wt switch -c user-authentication --base main
wt switch -c fix-balance-calc --base main
wt switch -c update-dependencies --base main
# Fallback (no worktrunk)
git fetch origin main
git checkout -b user-authentication origin/main
Convert description to kebab-case:
add-user-authenticationfix-null-pointer-in-loginBanned:
Required:
wt switch -c when availableCreate a pull request with smart template selection based on commit type.
! git branch --show-current
! git log origin/main..HEAD --oneline 2>/dev/null | head -10
! git diff --stat origin/main 2>/dev/null | tail -5
! git status --short
BRANCH=$(git branch --show-current)
[[ "$BRANCH" == "main" || "$BRANCH" == "master" ]] && echo "ERROR: Create feature branch first with wt switch -c <name> --base main (or /branch)"
If on main -> stop and instruct to use /branch first.
If uncommitted changes exist, use /commit workflow first.
Before pushing, sync with main to avoid conflicts:
Skill({ skill: "git-workflow", args: "sync --rebase" })
git push -u origin $(git branch --show-current)
Ask user for PR type:
Determine primary commit type from first commit:
PRIMARY_TYPE=$(git log origin/main..HEAD --format="%s" | head -1 | cut -d'(' -f1)
| Commit Type | Template Style |
|-------------|----------------|
| feat | Feature template (summary, motivation, changes) |
| refactor, docs, chore, test | Refactor template (what/why/impact) |
| fix, other | Fix template (problem, solution, testing) |
Fill template with:
{{SUMMARY}} - Brief description from commits{{COMMITS}} - List of commits{{FILES_CHANGED}} - Files modified{{WHY}} - Motivation (extract from plan if exists)Include implementation plan if available:
PLAN_FILE=$(ls -t ~/.claude/plans/*.md 2>/dev/null | head -1)
[[ -n "$PLAN_FILE" ]] && PLAN_CONTENT=$(cat "$PLAN_FILE")
# Ready for review
gh pr create --title "type(scope): description" --body "$(cat <<'EOF'
## Summary
- Brief description of changes
## Changes
- List of changes made
## Test Plan
- [ ] Tests pass locally
- [ ] Manual testing completed
EOF
)"
# Draft PR
gh pr create --draft --title "..." --body "..."
gh pr merge $(gh pr view --json number -q '.number') --auto --squash
gh pr view --json url -q '.url'
Banned:
/branch firstRequired:
Push commits to remote with safety checks and auto-retry.
! git branch --show-current
! git status --short
! git log origin/$(git branch --show-current 2>/dev/null)..HEAD --oneline 2>/dev/null || echo "New branch or no upstream"
Before pushing, sync with main to avoid conflicts:
Skill({ skill: "git-workflow", args: "sync --rebase" })
This delegates to the sync command which handles fetch, rebase, conflict resolution, and push.
| Situation | Command | Why |
|-----------|---------|-----|
| New branch | git push -u origin branch | Sets upstream tracking |
| Normal commits | git push | Standard push |
| After rebase | git push --force-with-lease | Safer than --force |
| After amend | git push --force-with-lease | History rewritten |
BRANCH=$(git branch --show-current)
# Block protected branches
if [[ "$BRANCH" == "main" || "$BRANCH" == "master" ]]; then
echo "ERROR: Cannot push directly to $BRANCH"
exit 1
fi
# New branch (set upstream)
git push -u origin "$BRANCH"
# Existing branch (normal push)
git push
# After rebase (force with lease for safety)
git push --force-with-lease
If push is rejected because remote has new commits:
BRANCH=$(git branch --show-current)
if ! git push; then
git fetch origin "$BRANCH"
if [ -n "$(git log HEAD..origin/$BRANCH --oneline 2>/dev/null)" ]; then
echo "Remote has new commits. Rebasing..."
git rebase "origin/$BRANCH"
git push --force-with-lease
fi
fi
Banned:
git push --force (use --force-with-lease instead)Required:
-u flag for new branches--force-with-lease after rebase/amend-u flag for new branches--force-with-lease (not --force) if neededSync current branch with main (or specified base) using merge or rebase.
! git branch --show-current
! git fetch origin main 2>&1 | head -3
! git log --oneline HEAD..origin/main 2>/dev/null | head -5 || echo "Up to date or no origin/main"
! git status --short
base: Base branch to sync with (default: main)--rebase: Use rebase strategy without prompting (for automated sync before push)--merge: Use merge strategy without prompting--rebase or --merge flag if provided, otherwise ask user# Parse arguments
BASE="main"
STRATEGY=""
for arg in "$@"; do
case "$arg" in
--rebase) STRATEGY="rebase" ;;
--merge) STRATEGY="merge" ;;
*) BASE="$arg" ;;
esac
done
# Fetch latest
git fetch origin "$BASE"
# If no strategy flag provided, ask user (see Merge vs Rebase Decision below)
# If --rebase flag: use rebase
# If --merge flag: use merge
# MERGE (preserves history, creates merge commit)
git merge "origin/$BASE" --no-edit
# OR REBASE (linear history, rewrites commits)
git rebase "origin/$BASE"
# Push after merge
git push
# Push after rebase
git push --force-with-lease
| Aspect | Merge | Rebase | |--------|-------|--------| | History | Preserves branches | Linear, clean | | Commit | Creates merge commit | Rewrites commits | | Push | Normal push | Force push required | | Shared branch | Safe | Dangerous | | Solo feature | OK | Preferred |
Use MERGE when:
Use REBASE when:
Conflict markers:
<<<<<<< HEAD
your changes
=======
incoming changes
>>>>>>> origin/main
Resolution options:
After resolving:
# For merge
git add <resolved-files>
git commit -m "merge: resolve conflicts with main"
# For rebase
git add <resolved-files>
git rebase --continue
# Abort merge in progress
git merge --abort
# Abort rebase in progress
git rebase --abort
# Reset to before sync
git reset --hard ORIG_HEAD
Banned:
git push --force (use --force-with-lease)Required:
--force-with-lease after rebaseExecute a comprehensive code review using specialized review agents.
! git branch --show-current
! git merge-base HEAD main 2>/dev/null || echo "main"
! git diff --name-only $(git merge-base HEAD main 2>/dev/null || echo "HEAD~1") HEAD 2>/dev/null | head -20
Spawn the code-reviewer agent to apply domain-specific checklists:
Task({
subagent_type: "build-mode:code-reviewer",
description: "Apply domain checklists",
prompt: `Review the following files for code quality:
Files: ${ARGUMENTS || "changed files on current branch"}
Apply relevant domain checklists:
- Frontend (React patterns, accessibility, data fetching)
- API (input validation, error responses, auth)
- Data layer (schemas, transactions, indexes)
- Testing (behavior focus, realistic data, coverage)
Report findings with priorities (P1: must fix, P2: should fix, P3: nice to have).`
})
Spawn the quality-reviewer agent for 3-pass quality analysis:
Task({
subagent_type: "build-mode:quality-reviewer",
description: "Review code quality",
prompt: `Review code quality for:
Files: ${ARGUMENTS || "changed files on current branch"}
3-pass review:
1. Style - naming, formatting, magic numbers
2. Patterns - DRY, single responsibility, abstraction level
3. Maintainability - change impact, dependencies, testability
Only report issues with 80%+ confidence. Distinguish must-fix from nice-to-have.`
})
Spawn the security-reviewer agent for security audit:
Task({
subagent_type: "build-mode:security-reviewer",
description: "Security audit",
prompt: `Security review for:
Files: ${ARGUMENTS || "changed files on current branch"}
Check against OWASP Top 10:
- Injection vulnerabilities (SQL, XSS, command)
- Authentication/authorization issues
- Cryptographic failures
- Security misconfigurations
- Hardcoded secrets
Report P0 (critical), P1 (high), P2 (medium) issues.`
})
Spawn the silent-failure-hunter agent to check error handling:
Task({
subagent_type: "build-mode:silent-failure-hunter",
description: "Check error handling",
prompt: `Hunt for silent failures in:
Files: ${ARGUMENTS || "changed files on current branch"}
Find:
- Empty catch blocks
- Silent returns on error
- Broad exception catching
- Missing error propagation
- Swallowed rejections
Classify: P0 (must fix), P1 (should fix), P2 (consider).`
})
After all reviews complete, aggregate findings:
## Review Summary
### Critical Issues (P0)
[List all P0 issues from all reviewers]
### High Priority (P1)
[List all P1 issues]
### Medium Priority (P2)
[List all P2 issues]
### Low Priority (P3)
[List all P3 issues]
### Verdict: [PASS / NEEDS FIXES]
- Pass: No P0 issues, P1 issues are minor
- Needs Fixes: Any P0 issues or multiple P1 issues
For targeted reviews, use arguments:
--security-only - Only security-reviewer--quality-only - Skip security and error handling--quick - Only code-reviewer with reduced scopeBanned:
Required:
Fix all unresolved PR review comments and CI failures with educational feedback.
! git branch --show-current
! git status --short
! gh pr view --json number,title,state,reviewDecision 2>/dev/null || echo "No PR found"
! gh pr checks 2>/dev/null | head -20 || echo "No checks"
# Get unresolved review threads (uses GraphQL API - reviewThreads field doesn't exist in gh pr view)
! {baseDir}/scripts/get-unresolved-threads.sh 2>/dev/null | head -30 || echo "No unresolved threads"
# Get PR issue comments (general comments like Codex/Gemini reviews, not inline threads)
! {baseDir}/scripts/get-issue-comments.sh --actionable 2>/dev/null | head -30 || echo "No issue comments"
Extract from the data above:
For each unresolved thread, issue comment, or CI failure:
Issue comments (like Codex or Gemini reviews) often contain:
Before pushing, verify locally:
bun run lint
bun run test
bun run ci # if available
Before pushing fixes, sync with main:
Skill({ skill: "git-workflow", args: "sync --rebase" })
Use single responsibility - delegate to commit-push:
Skill({ skill: "git-workflow", args: "commit-push fix: address PR review comments" })
Or manually:
git add -A
git commit -m "fix: address PR review comments"
git push --force-with-lease
For EACH unresolved thread, provide feedback using symbols:
Resolve thread via GraphQL:
# Get thread IDs from context (already fetched above) or fetch again
THREADS=$({baseDir}/scripts/get-unresolved-threads.sh)
THREAD_ID=$(echo "$THREADS" | jq -r '.id' | head -1)
# Resolve the thread
{baseDir}/scripts/resolve-thread.sh "$THREAD_ID"
Example feedback patterns:
[checkmark] Good catch! The null check was missing. Fixed in abc123.
[half-circle] Valid concern but useMemo is premature here since component rarely re-renders. Added comment explaining tradeoff.
[x] This pattern is intentional for TypeScript discriminated unions. The 'redundant' check enables type narrowing. Added clarifying comment.
{baseDir}/scripts/count-unresolved-threads.sh
Should return 0.
If CI fails after push:
gh pr checks --watchMax 3 CI retry iterations before escalating.
Banned:
Required:
Update an existing PR's title and body based on current commits.
! gh pr view --json number,title,baseRefName 2>/dev/null || echo "No PR found"
! git log origin/main..HEAD --oneline 2>/dev/null | head -10
! git diff --stat origin/main 2>/dev/null | tail -5
PR_NUM=$(gh pr view --json number -q '.number' 2>/dev/null)
[[ -z "$PR_NUM" ]] && echo "ERROR: No PR found for current branch"
If no PR found -> stop and instruct to use /pr first.
Fetch current PR body and identify preserved sections:
gh pr view --json body -q '.body'
Parse for preserved content:
# User description blockUse Full Regenerate mode if:
--regenerate flag is passed, OROtherwise use Incremental Update mode.
BASE=$(gh pr view --json baseRefName -q '.baseRefName')
git log origin/${BASE}..HEAD --pretty=format:"%s" | head -20
git diff --stat origin/${BASE}
type(scope): summary of changesFor Incremental Update:
## Commits with current commit list## Files Changed with current diff statFor Full Regenerate:
Include plan if available:
PLAN_FILE=$(ls -t ~/.claude/plans/*.md 2>/dev/null | head -1)
[[ -n "$PLAN_FILE" ]] && PLAN_CONTENT=$(cat "$PLAN_FILE")
gh pr edit $PR_NUM --title
<!-- Content truncated for initial SEO render. Open the source file tab for the full file. -->
npx skills add settlemint-archive/git-workflow下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer