| name | git-workflow |
| description | Use when committing code, pushing changes, or managing Git operations that require safety checks |
| version | 1 |
Git Workflow Skill
Overview
Automate Git operations with safety checks and user confirmation. This skill ensures changes are reviewed and explicitly approved before committing or pushing.
When to Use
-
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
When NOT to use:
- When you need automated/unattended commits without user interaction
- When performing complex Git operations beyond standard commit/push workflows
- When a different skill or tool is explicitly designated for Git operations
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 status before 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 git@github.com
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"
git status
git rev-parse --git-dir
"Permission denied"
ssh -T git@github.com
git remote set-url origin https://github.com/username/repo.git
"failed to push"
git pull origin main