1---2name: git-workflows3description: Local git operations for syncing, branching, merging, and conflict resolution4---56# Git Workflows78A comprehensive suite of git workflow skills for local repository operations.910## Input Sanitization1112- Branch names: alphanumeric, hyphens, underscores, forward slashes, and dots only — reject `..`, shell metacharacters, or null bytes13- Remote names: alphanumeric and hyphens only14- File paths for stash/diff: reject `..` traversal, null bytes, and shell metacharacters1516## Available Skills1718### Sync & Remote Operations19| Skill | Purpose | Invoke |20|-------|---------|--------|21| `/git-sync` | Fetch and show remote changes | `git sync`, `what's new upstream` |22| `/git-pull` | Pull with merge/rebase strategy | `git pull`, `get latest` |23| `/git-push` | Push with upstream handling | `git push`, `push changes` |2425### Stash Management26| Skill | Purpose | Invoke |27|-------|---------|--------|28| `/git-stash` | Save/pop/list stashed changes | `git stash`, `save my work` |2930### Branch Operations31| Skill | Purpose | Invoke |32|-------|---------|--------|33| `/git-branch` | Create branches with naming conventions | `git branch`, `new branch` |34| `/git-switch` | Switch branches safely | `git switch`, `checkout branch` |35| `/git-branches` | List and visualize branch status | `git branches`, `list branches` |36| `/git-delete-branch` | Delete local/remote with safety | `delete branch`, `cleanup branch` |3738### Integration & Merging39| Skill | Purpose | Invoke |40|-------|---------|--------|41| `/git-merge-main` | Merge main into feature branch | `merge main`, `update from main` |42| `/git-rebase` | Rebase onto main with guidance | `git rebase`, `rebase onto main` |43| `/git-squash` | Squash commits non-interactively | `git squash`, `clean up commits` |4445### Conflict & Recovery46| Skill | Purpose | Invoke |47|-------|---------|--------|48| `/git-abort` | Abort failed merge/rebase/cherry-pick | `git abort`, `cancel merge` |49| `/git-conflicts` | Guided conflict resolution | `git conflicts`, `fix conflicts` |5051## Quick Reference5253```bash54# Sync workflow55/git-sync # See what's new56/git-pull # Get changes57/git-push # Push changes5859# Branch workflow60/git-branch feat/xyz # Create branch61/git-switch main # Switch branch62/git-branches # See all branches6364# Integration65/git-merge-main # Update from main66/git-rebase # Rebase on main67/git-squash # Clean up history68```6970## Gotchas7172- Interactive rebase (`git rebase -i`) requires a TTY and fails in Claude Code — use `git rebase` (non-interactive) or `git rebase --onto`73- `git checkout` is ambiguous (branches vs files) — prefer `git switch` for branches, `git restore` for files74- Force-push (`--force`) to protected branches is rejected by most remotes — use `--force-with-lease` which fails if remote has new commits75- `git stash` doesn't stash untracked files — use `git stash -u` to include untracked76- `git pull` with diverged branches creates merge commits — use `git pull --rebase` or `git pull --ff-only` to avoid surprise merges77- `git add .` stages everything including `.env` files and secrets — always use `git add <specific-files>` or check `git status` first7879## Related Skills8081- `/commit` - Create commits with conventional messages82- `/commit-push-pr` - Full commit, push, and PR workflow83- `/gh-pr-*` - GitHub PR operations