{"skill":{"slug":"git-workflows-pro","displayName":"git-workflows-pro","summary":"Handle advanced git workflows and recovery tasks. Use when the user needs help with interactive rebase, commit cleanup, conflict resolution, reflog recovery,...","description":"---\nname: git-workflows-pro\ndescription: Handle advanced git workflows and recovery tasks. Use when the user needs help with interactive rebase, commit cleanup, conflict resolution, reflog recovery, cherry-pick, stash, worktree, bisect, submodule vs subtree decisions, sparse checkout, branch archaeology, or undoing dangerous history mistakes in real repositories.\n---\n\n# Git Workflows\n\nUse this skill for non-trivial git work where safety, history clarity, or repository structure matters more than a single command.\n\nKeep the main thread focused on the user’s goal. Prefer the smallest safe sequence of git operations.\n\n## Core approach\n\nBefore suggesting commands, determine:\n\n1. the user’s goal\n2. whether history is already shared with others\n3. whether the task changes commits, refs, working tree, or repository structure\n4. whether recovery should be prepared first\n\nIf a step is destructive or hard to reverse, create a safety point first.\n\n## Default safety rules\n\n- Check `git status` before history edits.\n- Check the current branch and upstream before rebases, resets, or force-pushes.\n- Prefer non-destructive inspection first.\n- Prefer `git switch` and `git restore` over older mixed forms when clarity matters.\n- Create a recovery point before risky history surgery.\n- Avoid rewriting shared history unless the user explicitly wants that tradeoff.\n- When conflicts or recovery are involved, explain both the immediate fix and the rollback path.\n\n## Recovery-first moves\n\nUse these patterns early when risk is high:\n\n```bash\ngit status\ngit branch backup/$(date +%Y%m%d-%H%M%S)-preop\n```\n\nFor history recovery, inspect before changing anything:\n\n```bash\ngit reflog --date=local --decorate -n 30\ngit log --oneline --graph --decorate -n 30\n```\n\nRead `references/recovery.md` for reflog-based recovery, reset recovery, branch recovery, and force-push mistakes.\n\n## Common task families\n\n### History cleanup\n\nUse for:\n\n- squashing fix commits\n- rewording commit messages\n- splitting a bad commit\n- dropping accidental commits\n- preparing a branch before merge\n\nPrefer interactive rebase for local or not-yet-shared history.\n\n### Bug origin hunting\n\nUse `git bisect` when the user knows a good state and a bad state and needs to find the introducing commit.\n\n### Parallel branch work\n\nUse `git worktree` when the user needs two branches checked out at once, wants cleaner hotfix flow, or wants to avoid stashing.\n\n### Conflict handling\n\nResolve carefully when rebasing, merging, cherry-picking, or applying stashes. Preserve user intent, not just file merge success.\n\n### Repository archaeology\n\nUse blame, pickaxe, grep, log graph, and path history when the user needs to answer:\n\n- who changed this\n- when did this break\n- where did this line come from\n- which commit removed this behavior\n\n### Repository shape changes\n\nUse extra care for:\n\n- submodules\n- subtrees\n- sparse checkout\n- worktree pruning\n- branch renames\n- default-branch migration\n\nRead `references/advanced-patterns.md` when the task involves repository topology rather than simple day-to-day commits.\n\n## Decision rules\n\n### Rebase vs merge\n\n- Prefer rebase for cleaning local feature-branch history.\n- Prefer merge when preserving shared branch history matters.\n- If the branch is already shared, explicitly call out the rewrite risk before rebasing.\n\n### Subtree vs submodule\n\n- Prefer subtree when the user wants simpler consumption and fewer contributor footguns.\n- Prefer submodule when the user truly needs a pinned external repository boundary.\n\n### Worktree vs stash\n\n- Prefer worktree for medium or long parallel work.\n- Prefer stash for short interruptions or tiny context switches.\n\n### Reset vs restore vs revert\n\n- Prefer `restore` for file-level undo.\n- Prefer `reset` for local history and index surgery.\n- Prefer `revert` for undoing commits that are already shared.\n\n## Operating style\n\nWhen guiding the user:\n\n1. say what state to inspect first\n2. state the safest command sequence\n3. note whether history is being rewritten\n4. give the rollback path when risk is non-trivial\n\nKeep command sets short. Do not dump every git option unless needed.\n\n## When to read references\n\n- Read `references/recovery.md` for reflog recovery, accidental reset, branch resurrection, detached HEAD recovery, or force-push mistakes.\n- Read `references/history-surgery.md` for interactive rebase, commit splitting, autosquash, cherry-pick cleanup, and safe force-push guidance.\n- Read `references/advanced-patterns.md` for worktree, bisect, subtree, submodule, sparse checkout, and repository-structure decisions.\n\n## Output template\n\nWhen responding on a git workflow task, prefer this structure:\n\n- **Goal**:\n- **Risk level**:\n- **Safe first check**:\n- **Recommended commands**:\n- **Rollback path**:\n- **Shared-history warning**:\n","topics":["Git"],"tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":590,"installsAllTime":22,"installsCurrent":0,"stars":1,"versions":1},"createdAt":1773368367895,"updatedAt":1778491872769},"latestVersion":{"version":"1.0.0","createdAt":1773368367895,"changelog":"git-workflows-pro 1.0.0 initial release\n\n- Provides advanced guidance for Git workflows and repository recovery.\n- Covers interactive rebase, commit cleanup, conflict resolution, reflog recovery, cherry-pick, stash, worktree, bisect, submodule vs subtree, sparse checkout, branch archaeology, and undoing dangerous history changes.\n- Emphasizes safety checks and recovery points before destructive actions.\n- Includes decision rules for rebase vs merge, subtree vs submodule, and worktree vs stash scenarios.\n- Outlines a clear, template-driven approach for supporting complex Git tasks and troubleshooting.","license":"MIT-0"},"metadata":null,"owner":{"handle":"darinrowe","userId":"s176z8f7hbt9xnpjc8k8h36tsd885s1a","displayName":"DarinRowe","image":"https://avatars.githubusercontent.com/u/5706314?v=4"},"moderation":null}