From contextune
Deterministic commit and push workflow using scripts (DRY compliant)
How this command is triggered — by the user, by Claude, or both
Slash command
/contextune:ctx-git-commitFiles this command reads when invoked
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Git Commit - Deterministic Commit and Push Workflow
You are executing a deterministic git commit and push workflow.
**Cost:** ~$0.002 (545 tokens) vs ~$0.037-0.086 (8K-25K tokens) for multi-tool approach
**Savings:** 93-97% token reduction
---
## Workflow
### Step 1: Determine What to Commit
Check git status to understand what files changed:
**Analyze the output:**
- `M` = Modified files
- `A` = Added files
- `D` = Deleted files
- `??` = Untracked files
### Step 2: Stage and Commit
**Use the plugin's commit script (works from any project):**
> **Note:** `${CLAUDE_PLUGIN_ROOT...You are executing a deterministic git commit and push workflow.
Cost: ~$0.002 (545 tokens) vs ~$0.037-0.086 (8K-25K tokens) for multi-tool approach Savings: 93-97% token reduction
Check git status to understand what files changed:
git status --short
Analyze the output:
M = Modified filesA = Added filesD = Deleted files?? = Untracked filesUse the plugin's commit script (works from any project):
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh" "<files>" "<message>" "<branch>" "<remote>"
Note:
${CLAUDE_PLUGIN_ROOT}is automatically set by Claude Code to the plugin's installation directory (e.g.,~/.claude/plugins/contextune@Contextune/). This ensures the script is always accessible regardless of which project you're working in.
Parameters:
<files> - Files to commit (use . for all changes, or specific files)<message> - Commit message (follows conventional commits format)<branch> - Branch name (auto-detected from current branch, optional)<remote> - Remote name (auto-detected if not specified, optional)Example 1: Commit all changes
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh" "." "feat: add new feature
Detailed description of changes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>"
Example 2: Commit specific files
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh" "src/feature.ts tests/feature.test.ts" "feat: implement feature X"
Example 3: Specify branch and remote
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh" "." "fix: resolve bug" "develop" "origin"
Follow conventional commits:
<type>: <description>
[optional body]
[optional footer]
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Types:
feat: - New featurefix: - Bug fixdocs: - Documentation changesrefactor: - Code refactoringtest: - Test changeschore: - Build/tooling changesExamples:
# Feature
"feat: add user authentication
Implemented JWT-based authentication with refresh tokens.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>"
# Bug fix
"fix: resolve memory leak in WebSocket handler
Fixed issue where connections were not properly cleaned up.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>"
# Documentation
"docs: update API documentation
Added examples for new endpoints.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>"
The commit_and_push.sh script handles:
git add <files> - Stage specified filesgit commit -m "<message>" - Commit with messagegit push <remote> <branch> - Push to remoteScript output:
✅ Committed and pushed to origin/master
If script fails:
No changes to commit:
ℹ️ No changes to commit
No git remotes:
Error: No git remotes configured
git remote add origin <url>Permission denied:
Error: Permission denied
Merge conflicts:
Error: Merge conflict detected
git pull <remote> <branch>The commit script is part of the Contextune plugin and is automatically accessible via:
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh"
Where CLAUDE_PLUGIN_ROOT resolves to:
~/.claude/plugins/contextune@Contextune/ (typical installation)Fallback (if env var not set):
git add <files> && git commit -m "<message>" && git push
Multi-tool approach (what NOT to do):
Tool 1: git status
Tool 2: git add .
Tool 3: git status --short
Tool 4: git diff --cached
Tool 5: git commit -m "message"
Tool 6: git log -1
Tool 7: git push origin master
Tool 8: git status
Cost: ~8K-25K tokens ($0.037-0.086)
Efficient approach (correct):
Tool 1: git add . && git commit -m "message" && git push
Cost: ~545 tokens ($0.002)
Savings: 93-97% reduction
This command is available via:
Explicit command: /ctx:git-commit
Natural language: Contextune detects and routes automatically:
PreToolUse hook: Intercepts manual git commands and suggests script
/ctx:git-pr - Create pull request using script/ctx:git-merge - Merge branches using script/ctx:cleanup - Cleanup worktrees and branches# Commit specific directories
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh" "src/ tests/" "feat: implement feature"
# Commit specific file types
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh" "*.ts *.tsx" "refactor: update types"
"${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh" "." "feat: add authentication
Implemented features:
- JWT token generation
- Refresh token rotation
- User session management
Breaking changes:
- Auth API endpoints changed from /api/v1 to /api/v2
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>"
${CLAUDE_PLUGIN_ROOT} - This resolves to the plugin's installation directorygit status) are always OK without scriptUNIFIED_DRY_STRATEGY.md - DRY strategy for git operations${CLAUDE_PLUGIN_ROOT}/scripts/commit_and_push.sh - Script source code${CLAUDE_PLUGIN_ROOT}/scripts/smart_execute.sh - Error recovery wrapper${CLAUDE_PLUGIN_ROOT}/scripts/create_pr.sh - Create pull request script${CLAUDE_PLUGIN_ROOT}/scripts/merge_and_cleanup.sh - Merge and cleanup scriptnpx claudepluginhub joshuarweaver/cascade-code-general-misc-2 --plugin shakestzd-contextune/SKILLCreates conventional git commit from conversation intent using git-agent and pushes to remote. Accepts optional Claude model name for co-author.
/commitStages and commits changes from the current session with a conventional commit message and co-author attribution.
/commitStages changes and commits locally using Conventional Commits format. Analyzes git status/diffs, drafts typed message with scope, confirms with user before git add and commit.
/commitAnalyzes uncommitted changes, generates conventional commit messages, intelligently stages and groups related files, then commits. Supports interactive review, push, and grouping options.
/commit-and-pushReviews git changes, stages appropriate files excluding generated/secrets, crafts conventional commit message, commits, and pushes to remote repository.
/commitGenerates conventional commit message from git changes, stages unstaged files if needed, commits, and pushes to current branch. Optionally creates and pushes a version tag with custom instructions.