| name | commit-commands |
| description | Git commit and repository workflows |
Commit Workflows
Overview
Commit Commands Plugin
Streamline your git workflow with simple commands for committing, pushing, and creating pull requests.
Overview
The Commit Commands Plugin automates common git operations, reducing context switching and manual command execution. Instead of running multiple git commands, use a single slash command to handle your entire workflow.
Commands
commit
Creates a git commit with an automatically generated commit message based on staged and unstaged changes.
What it does:
- Analyzes current git status
- Reviews both staged and unstaged changes
- Examines recent commit messages to match your repository's style
- Drafts an appropriate commit message
- Stages relevant files
- Creates the commit
Usage:
/commit
Example workflow:
/commit
Features:
- Automatically drafts commit messages that match your repo's style
- Follows conventional commit practices
- Avoids committing files with secrets (.env, credentials.json)
- Includes coding assistant attribution in commit message
commit-push-pr
Complete workflow command that commits, pushes, and creates a pull request in one step.
What it does:
- Creates a new branch (if currently on main)
- Stages and commits changes with an appropriate message
- Pushes the branch to origin
- Creates a pull request using
gh pr create
- Provides the PR URL
Usage:
/commit-push-pr
Example workflow:
/commit-push-pr
Features:
- Analyzes all commits in the branch (not just the latest)
- Creates comprehensive PR descriptions with:
- Summary of changes (1-3 bullet points)
- Test plan checklist
- coding assistant attribution
- Handles branch creation automatically
- Uses GitHub CLI (
gh) for PR creation
Requirements:
- GitHub CLI (
gh) must be installed and authenticated
- Repository must have a remote named
origin
clean_gone
Cleans up local branches that have been deleted from the remote repository.
What it does:
- Lists all local branches to identify [gone] status
- Identifies and removes worktrees associated with [gone] branches
- Deletes all branches marked as [gone]
- Provides feedback on removed branches
Usage:
/clean_gone
Example workflow:
/clean_gone
Features:
- Handles both regular branches and worktree branches
- Safely removes worktrees before deleting branches
- Shows clear feedback about what was removed
- Reports if no cleanup was needed
When to use:
- After merging and deleting remote branches
- When your local branch list is cluttered with stale branches
- During regular repository maintenance
Installation
This plugin is included in the coding assistant repository. The commands are automatically available when using coding assistant.
Best Practices
Using commit
- Review the staged changes before committing
- Let Claude analyze your changes and match your repo's commit style
- Trust the automated message, but verify it's accurate
- Use for routine commits during development
Using commit-push-pr
- Use when you're ready to create a PR
- Ensure all your changes are complete and tested
- Claude will analyze the full branch history for the PR description
- Review the PR description and edit if needed
- Use when you want to minimize context switching
Using clean_gone
- Run periodically to keep your branch list clean
- Especially useful after merging multiple PRs
- Safe to run - only removes branches already deleted remotely
- Helps maintain a tidy local repository
Workflow Integration
Quick commit workflow:
/commit
Feature branch workflow:
/commit
/commit
/commit-push-pr
Maintenance workflow:
/clean_gone
Requirements
- Git must be installed and configured
- For
commit-push-pr: GitHub CLI (gh) must be installed and authenticated
- Repository must be a git repository with a remote
Troubleshooting
commit creates empty commit
Issue: No changes to commit
Solution:
- Ensure you have unstaged or staged changes
- Run
git status to verify changes exist
commit-push-pr fails to create PR
Issue: gh pr create command fails
Solution:
- Install GitHub CLI:
brew install gh (macOS) or see GitHub CLI installation
- Authenticate:
gh auth login
- Ensure repository has a GitHub remote
clean_gone doesn't find branches
Issue: No branches marked as [gone]
Solution:
- Run
git fetch --prune to update remote tracking
- Branches must be deleted from the remote to show as [gone]
Tips
- Combine with other tools: Use
commit during development, then commit-push-pr when ready
- Let Claude draft messages: The commit message analysis learns from your repo's style
- Regular cleanup: Run
clean_gone weekly to maintain a clean branch list
- Review before pushing: Always review the commit message and changes before pushing
Author
Anthropic (support@anthropic.com)
Version
1.0.0
Commands / Workflows
Command: clean_gone
Description: Cleans up all git branches marked as [gone] (branches that have been deleted on the remote but still exist locally), including removing associated worktrees.
Your Task
You need to execute the following bash commands to clean up stale local branches that have been deleted from the remote repository.
Commands to Execute
-
First, list branches to identify any with [gone] status
Execute this command:
git branch -v
Note: Branches with a '+' prefix have associated worktrees and must have their worktrees removed before deletion.
-
Next, identify worktrees that need to be removed for [gone] branches
Execute this command:
git worktree list
-
Finally, remove worktrees and delete [gone] branches (handles both regular and worktree branches)
Execute this command:
git branch -v | grep '\[gone\]' | sed 's/^[+* ]//' | awk '{print $1}' | while read branch; do
echo "Processing branch: $branch"
worktree=$(git worktree list | grep "\\[$branch\\]" | awk '{print $1}')
if [ ! -z "$worktree" ] && [ "$worktree" != "$(git rev-parse --show-toplevel)" ]; then
echo " Removing worktree: $worktree"
git worktree remove --force "$worktree"
fi
echo " Deleting branch: $branch"
git branch -D "$branch"
done
Expected Behavior
After executing these commands, you will:
- See a list of all local branches with their status
- Identify and remove any worktrees associated with [gone] branches
- Delete all branches marked as [gone]
- Provide feedback on which worktrees and branches were removed
If no branches are marked as [gone], report that no cleanup was needed.
Command: commit-push-pr
Description: Commit, push, and open a PR
Context
- Current git status: (Retrieve by running
git status with your bash tool)
- Current git diff (staged and unstaged changes): (Retrieve by running
git diff HEAD with your bash tool)
- Current branch: (Retrieve by running
git branch --show-current with your bash tool)
Your task
Based on the above changes:
- Create a new branch if on main
- Create a single commit with an appropriate message
- Push the branch to origin
- Create a pull request using
gh pr create
- You have the capability to call multiple tools in a single response. You MUST do all of the above in a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls.
Command: commit
Description: Create a git commit
Context
- Current git status: (Retrieve by running
git status with your bash tool)
- Current git diff (staged and unstaged changes): (Retrieve by running
git diff HEAD with your bash tool)
- Current branch: (Retrieve by running
git branch --show-current with your bash tool)
- Recent commits: (Retrieve by running
git log --oneline -10 with your bash tool)
Your task
Based on the above changes, create a single git commit.
You have the capability to call multiple tools in a single response. Stage and create the commit using a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls.
🔒 Pre-Execution Verification Gate
Before executing commands or submitting reviews, you MUST output a structured XML <verification_gate> block evaluating the following checks:
conventions: All changes align with target guidelines. (PASS/FAIL)
correctness: Verify code correctness and lack of logical bugs. (PASS/FAIL)
Example output format:
<verification_gate>
<conventions>PASS</conventions>
<correctness>PASS</correctness>
</verification_gate>
Do not proceed until you have output this verification gate.