| name | git-workflow |
| description | Advanced git operations: rebase strategies, cherry-pick workflows, bisect automation, worktree management, conflict resolution, branch cleanup. Use when: (1) complex git operations beyond basic add/commit/push, (2) resolving merge conflicts, (3) reorganizing commit history, (4) managing multiple working branches. NOT for: basic git (use git tools directly), GitHub API operations (use github skill). |
| when_to_use | Use when the user needs help with complex git operations, conflict resolution, or branch management. |
| user-invocable | true |
| disable-model-invocation | true |
Git Workflow
Advanced git operations done safely with recovery points.
Goal
Execute complex git operations without losing work.
Safety Rules
- Always check
git_status first. Stash or commit dirty work before destructive operations.
- Create a backup branch before rebase or reset:
git branch backup/before-rebase
- Never force-push to shared branches without explicit user confirmation.
Common Workflows
Interactive Rebase (squash/reorder/edit)
git log --oneline -10
git rebase -i HEAD~N
Cherry-Pick
git cherry-pick <commit-hash>
git cherry-pick <oldest>^..<newest>
git cherry-pick --continue
Bisect (find the commit that broke something)
git bisect start
git bisect bad HEAD
git bisect good <known-good>
git bisect good
git bisect bad
git bisect reset
Worktrees (parallel branches without stashing)
git worktree add ../feature-branch feature-branch
git worktree list
git worktree remove ../feature-branch
Conflict Resolution
- Check which files conflict:
git_status
- Read the conflicted file — look for
<<<<<<<, =======, >>>>>>>
- Decide: keep ours, theirs, or merge both
- Use
file_edit to resolve each conflict
git add <file> and git rebase --continue (or git merge --continue)
Branch Cleanup
git branch --merged main | grep -v main | xargs git branch -d
git fetch --prune
git for-each-ref --sort=-committerdate --format='%(refname:short) %(committerdate:relative)' refs/heads/
Undo Operations
git reset --soft HEAD~1
git reset HEAD~1
git reset --hard HEAD~1
git revert <commit-hash>
Guardrails
- Always confirm before force-push or hard reset.
- Prefer
git revert over git reset for pushed commits.
- Use
git reflog to recover from mistakes.
- When in doubt, create a backup branch first.