skills/git-workflows/skills/branches/SKILL.md
Use when listing local and remote branches or visualizing branch status and divergence.
npx skillsauth add dtsong/my-claude-setup git-branchesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
git fetch --prune to refresh remote tracking)--all, --merged, --no-merged, --stale accepted. Reject arbitrary strings or shell metacharacters.Show all branches with their status, tracking info, and sync state.
/git-branches # List all local branches with status
/git-branches --all # Include remote branches
/git-branches --merged # Only show merged branches
/git-branches --no-merged # Only show unmerged branches
/git-branches --stale # Show branches with deleted remotes
# Fetch to get accurate remote status
git fetch --all --prune --quiet
# List local branches with tracking info
git branch -vv
# For each branch, calculate ahead/behind
for branch in $(git branch --format='%(refname:short)'); do
upstream=$(git rev-parse --abbrev-ref "$branch@{u}" 2>/dev/null)
if [ -n "$upstream" ]; then
ahead=$(git rev-list --count "$upstream..$branch")
behind=$(git rev-list --count "$branch..$upstream")
echo "$branch: $ahead ahead, $behind behind of $upstream"
else
echo "$branch: no upstream"
fi
done
# Check if branch is merged into main
git branch --merged main
git branch --no-merged main
# Branches whose remote has been deleted
git branch -vv | grep ': gone]'
Branches (4 local, 6 remote)
* feat/dark-mode abc1234 [origin/feat/dark-mode: ahead 2]
Add theme toggle component
main def5678 [origin/main]
Latest release
feat/user-auth ghi9012 [origin/feat/user-auth: behind 3]
Add login form
fix/old-bug jkl3456 [origin: gone]
Fix deprecated (remote deleted)
Legend:
* = current branch
ahead N = local commits not pushed
behind N = remote commits not pulled
gone = remote branch deleted
Quick actions:
/git-switch <branch> # Switch to branch
/git-delete-branch <name> # Delete branch
/git-sync # Fetch updates
Branches merged into main:
fix/login-bug (merged 3 days ago)
feat/old-feature (merged 1 week ago)
chore/cleanup (merged 2 weeks ago)
These branches can be safely deleted with:
/git-delete-branch --merged
Stale branches (remote deleted):
feat/abandoned-feature [origin: gone] - Remote deleted
fix/old-bug [origin: gone] - Remote deleted
These branches have no remote tracking anymore.
Clean up with:
/git-delete-branch feat/abandoned-feature
/git-delete-branch --stale # Delete all stale
Local branches:
* feat/dark-mode abc1234 [ahead 2]
main def5678 [up to date]
Remote branches (origin):
origin/main
origin/feat/dark-mode
origin/feat/user-auth
origin/feat/api-v2
origin/HEAD -> origin/main
Remote branches not checked out locally:
origin/feat/api-v2 # /git-switch feat/api-v2 to check out
| Symbol | Meaning |
|--------|---------|
| * | Current branch |
| ahead N | N commits to push |
| behind N | N commits to pull |
| gone | Remote branch deleted |
| [up to date] | Synced with remote |
| [no upstream] | No remote tracking |
At the end of output, show summary:
Summary:
Current: feat/dark-mode
Total: 4 local, 6 remote
Ahead: 1 branch needs push
Behind: 1 branch needs pull
Stale: 2 branches (remote deleted)
Merged: 3 branches can be deleted
/git-switch <branch> to change branches/git-delete-branch to clean up branches/git-sync to update remote information/git-pull to sync branches that are behindtesting
Use to convert a Word .docx file to PDF and/or verify its page count. Triggers on: converting docx to pdf, rendering a document, checking how many pages a docx produces, or asserting a page-count constraint (e.g. a resume must stay 2 pages). Wraps LibreOffice headless conversion.
development
Security audit checklist for web applications. Use when reviewing, auditing, or hardening a web app's security posture. Covers rate limiting, auth headers, IP blocking, CORS, security middleware, input validation, file upload limits, ORM usage, and password hashing. Triggers on requests like "review security", "harden this app", "security audit", "check for vulnerabilities", or when building/reviewing API endpoints.
development
Interactive wizard to craft effective prompts using Claude Code best practices
tools
Use when batch labeling, prioritizing, and assigning GitHub issues during triage sessions.