# git-sync > Automated git operations including commit, push, pull request creation, and branch synchronization - Author: Claude Assistant - Repository: mfethe1/skills - Version: 20260123221508 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/mfethe1/skills - Web: https://mule.run/skillshub/@@mfethe1/skills~git-sync:20260123221508 --- --- name: git-sync description: Automated git operations including commit, push, pull request creation, and branch synchronization triggers: - git - commit - push - pr - sync --- # Git Sync Skill Automated git operations without consuming context. ## Trigger - `/git-sync` - Sync changes to git - `/commit` - Commit staged changes - `/push` - Commit and push - `/pr` - Commit, push, and create PR ## Usage Run the git-sync script directly: ```bash # Commit only (default) python ~/.claude/skills/git-sync/git_sync.py # Commit and push python ~/.claude/skills/git-sync/git_sync.py --push # Full workflow: commit, push, create PR python ~/.claude/skills/git-sync/git_sync.py --pr # Dry run to see what would happen python ~/.claude/skills/git-sync/git_sync.py --dry-run # Custom commit message python ~/.claude/skills/git-sync/git_sync.py -m "feat: my custom message" # JSON output for programmatic use python ~/.claude/skills/git-sync/git_sync.py --json ``` ## Integration with Stop Hook Add to stop_hook.py to auto-commit on each loop: ```python # At end of stop hook, after verification passes: import subprocess result = subprocess.run( ['python', os.path.expanduser('~/.claude/skills/git-sync/git_sync.py'), '--json'], capture_output=True, text=True ) ``` ## Behavior 1. **Check**: Verifies current directory is a git repo 2. **Stage**: Stages all modified tracked files (`git add -u`) 3. **Message**: Auto-generates commit message based on files changed 4. **Commit**: Creates commit with Co-Authored-By tag 5. **Push** (optional): Pushes to origin with tracking 6. **PR** (optional): Creates PR using `gh` CLI ## Output Returns JSON with: - `success`: boolean - `mode`: 'commit' | 'push' | 'pr' - `files_changed`: list of files - `commit_sha`: short SHA of commit - `pushed`: boolean - `pr_url`: URL if PR created - `message`: human-readable status ## Notes - Does NOT stage untracked files (use `git add` manually for new files) - Does NOT force push or amend - Requires `gh` CLI for PR creation - Safe to run multiple times (no changes = no commit) ## Verification ### Self-Check Workflow Before completing any task using this skill: 1. **Input Validation** - Verify all required inputs are present - Check input format and data types - Validate against expected patterns 2. **Execution Verification** - Confirm each step completes successfully - Check for error messages or warnings - Verify intermediate outputs 3. **Output Validation** - Verify output matches expected format - Check completeness of deliverables - Validate against success criteria ### Verification Commands | Check | Command/Action | Expected Result | |-------|---------------|-----------------| | Prerequisites | Verify dependencies available | All required tools accessible | | Execution | Run main workflow | No errors, expected output | | Quality | Review output quality | Meets acceptance criteria | ### Failure Handling If verification fails: 1. Document the failure point and error message 2. Attempt remediation (max 3 attempts) 3. If still failing, escalate with full context