1---2name: git-workflows3description: "Local git operations for syncing, branching, merging, and conflict resolution"4triggers:5 - "git workflow"6 - "git help"7 - "git operations"8user_invocable: true9---1011# Git Workflows1213A comprehensive suite of git workflow skills for local repository operations.1415## Input Sanitization1617- Branch names: alphanumeric, hyphens, underscores, forward slashes, and dots only — reject `..`, shell metacharacters, or null bytes18- Remote names: alphanumeric and hyphens only19- File paths for stash/diff: reject `..` traversal, null bytes, and shell metacharacters2021## Available Skills2223### Sync & Remote Operations24| Skill | Purpose | Invoke |25|-------|---------|--------|26| `/git-sync` | Fetch and show remote changes | `git sync`, `what's new upstream` |27| `/git-pull` | Pull with merge/rebase strategy | `git pull`, `get latest` |28| `/git-push` | Push with upstream handling | `git push`, `push changes` |2930### Stash Management31| Skill | Purpose | Invoke |32|-------|---------|--------|33| `/git-stash` | Save/pop/list stashed changes | `git stash`, `save my work` |3435### Branch Operations36| Skill | Purpose | Invoke |37|-------|---------|--------|38| `/git-branch` | Create branches with naming conventions | `git branch`, `new branch` |39| `/git-switch` | Switch branches safely | `git switch`, `checkout branch` |40| `/git-branches` | List and visualize branch status | `git branches`, `list branches` |41| `/git-delete-branch` | Delete local/remote with safety | `delete branch`, `cleanup branch` |4243### Integration & Merging44| Skill | Purpose | Invoke |45|-------|---------|--------|46| `/git-merge-main` | Merge main into feature branch | `merge main`, `update from main` |47| `/git-rebase` | Rebase onto main with guidance | `git rebase`, `rebase onto main` |48| `/git-squash` | Squash commits non-interactively | `git squash`, `clean up commits` |4950### Conflict & Recovery51| Skill | Purpose | Invoke |52|-------|---------|--------|53| `/git-abort` | Abort failed merge/rebase/cherry-pick | `git abort`, `cancel merge` |54| `/git-conflicts` | Guided conflict resolution | `git conflicts`, `fix conflicts` |5556## Quick Reference5758```bash59# Sync workflow60/git-sync # See what's new61/git-pull # Get changes62/git-push # Push changes6364# Branch workflow65/git-branch feat/xyz # Create branch66/git-switch main # Switch branch67/git-branches # See all branches6869# Integration70/git-merge-main # Update from main71/git-rebase # Rebase on main72/git-squash # Clean up history73```7475## Gotchas7677- Interactive rebase (`git rebase -i`) requires a TTY and fails in Claude Code — use `git rebase` (non-interactive) or `git rebase --onto`78- `git checkout` is ambiguous (branches vs files) — prefer `git switch` for branches, `git restore` for files79- Force-push (`--force`) to protected branches is rejected by most remotes — use `--force-with-lease` which fails if remote has new commits80- `git stash` doesn't stash untracked files — use `git stash -u` to include untracked81- `git pull` with diverged branches creates merge commits — use `git pull --rebase` or `git pull --ff-only` to avoid surprise merges82- `git add .` stages everything including `.env` files and secrets — always use `git add <specific-files>` or check `git status` first8384## Related Skills8586- `/commit` - Create commits with conventional messages87- `/commit-push-pr` - Full commit, push, and PR workflow88- `/gh-pr-*` - GitHub PR operations