Agent skill
git-workflow
Automate Git commit and push workflows with intelligent prompts and safety checks. Checks workspace status, lists changes, confirms with user, and handles push operations safely. Never commits without explicit user approval.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/git-workflow-dqz00116-skill-lib
SKILL.md
Git Workflow Skill
Automate Git operations with safety checks and user confirmation.
What This Skill Does
-
Checks Workspace Status
- Shows modified files
- Lists untracked files
- Detects conflicts or merge states
-
Smart Confirmation Prompt
- Lists all changes clearly
- Asks for explicit approval
- Provides multiple options (commit all, specific files, ignore, skip)
-
Safe Commit & Push
- Only commits after confirmation
- Handles GitHub authentication
- Reports success or failure
-
Conflict Detection
- Detects merge conflicts
- Suggests resolution steps
- Prevents force pushes
Quick Start
Simple Commit
python scripts/git_commit.py
The script will:
- Show
git status - Ask for confirmation
- Commit and push if approved
Interactive Mode
python scripts/git_commit.py --interactive
Step-by-step confirmation for each file.
Confirmation Format
đ **Git Status Summary:**
Modified:
- SOUL.md (41 insertions)
- README.md (5 deletions)
Untracked:
- new-feature.md
- temp.log (should be ignored?)
â
**Confirm:**
Reply:
- "yes" â commit all modified
- "commit with untracked" â commit all including untracked
- "only SOUL.md" â commit specific file
- "ignore temp.log" â add to .gitignore
- "skip" â do nothing
Safety Rules
Never
- â Commit without checking status first
- â Commit without user confirmation
- â Force push (
git push -f) - â Commit binary/temporary files without asking
Always
- â
Check
git statusbefore any operation - â Show list of changes for approval
- â
Respect
.gitignore - â Handle errors gracefully
- â Report what was done
Usage Examples
Example 1: Simple Workflow
$ python scripts/git_commit.py
đ Git Status:
M SOUL.md
?? new-file.md
đ Changes Summary:
Modified: SOUL.md
Untracked: new-file.md
â
Confirm: Reply "yes" to commit modified, "commit with untracked" for all, or specify files
> yes
đ Commit message: Update SOUL.md
â
Committed: a1b2c3d Update SOUL.md
đ Pushed to origin/main
Example 2: With Untracked Files
$ python scripts/git_commit.py
đ Git Status:
M README.md
?? temp.log
?? important.md
đ Changes Summary:
Modified: README.md
Untracked: temp.log, important.md
â
Confirm: What to commit?
> commit with untracked
â ī¸ temp.log looks like a temporary file. Add to .gitignore instead?
> yes
đ Commit message: Update README and add important docs
â
Committed: b2c3d4e Update README and add important docs
đ Pushed to origin/main
Example 3: Skip Everything
$ python scripts/git_commit.py
đ Git Status:
M SOUL.md
đ Changes Summary:
Modified: SOUL.md
â
Confirm: Reply "yes" to commit
> skip
âšī¸ Skipped. No changes committed.
Handling Edge Cases
Merge Conflicts
â ī¸ **Merge Conflict Detected!**
Conflicted files:
- README.md
- config.yaml
Cannot commit until conflicts are resolved.
Suggested steps:
1. Edit files to resolve conflicts
2. Run: git add <resolved-files>
3. Run this script again
Diverged Branches
â ī¸ **Local branch is behind remote**
Run: git pull origin main first?
> yes
Pulling latest changes...
[...]
â
Now you can commit your changes.
Authentication Issues
â **Push Failed: Authentication Error**
Possible causes:
- SSH key not configured
- Token expired
- Wrong remote URL
Suggested fixes:
1. Check: git remote -v
2. Test: ssh -T [email protected]
3. Or use HTTPS with token
Best Practices
- Check before committing: Always review changes
- Write clear messages: Describe what and why
- Commit related changes: One logical change per commit
- Don't commit secrets: Check for API keys, passwords
- Keep commits small: Easier to review and revert
Troubleshooting
"nothing to commit"
# Check if files are actually modified
git status
# Check if in git repository
git rev-parse --git-dir
"Permission denied"
# Check SSH key
ssh -T [email protected]
# Or use HTTPS
git remote set-url origin https://github.com/username/repo.git
"failed to push"
# Pull first
git pull origin main
# Resolve any conflicts
# Then commit again
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?