git Stinger
The procedural arsenal for git-worker-bee. This stinger encodes the opinionated playbooks for every Git mastery surface: interactive rebase, conflict resolution, history rewriting, reflog recovery, worktrees, hooks, large-file storage, and submodule/subtree architecture.
When invoked, read SKILL.md first, then the relevant guide(s) for the task at hand. Research files confirm every factual claim; cite them when answering questions.
Scope and non-scope
In scope:
- Branching strategy advisory (trunk-based, Git Flow, GitHub Flow)
- Interactive rebase: squash, fixup, reword, drop, reorder, exec, autosquash
- Conflict resolution: merge conflicts, rebase conflicts, rerere, mergetool config
- History rewriting:
git filter-repo, BFG Repo Cleaner, removing secrets/large files
- Reset/reflog recovery: all three reset types, recovering deleted branches and commits
- Git worktrees: parallel branch work without stashing
- Hooks: client-side (pre-commit, commit-msg, pre-push) and server-side hand-off
- Submodules vs subtrees decision matrix and lifecycle
- Git LFS: setup,
.gitattributes, selective fetch, CI patterns
- Partial clone (
--filter=blob:none) and sparse checkout v2 (--cone mode)
- Commit signing: GPG and SSH signature verification
Not in scope:
- CI/CD pipeline configuration using Git events -> ci-release-worker-bee
- Server-side hook configuration in CI/CD runners -> ci-release-worker-bee
- Credential rotation after a secrets-in-history incident -> security-worker-bee
- Secret scanning policies and repository security tooling -> security-worker-bee
- GitHub/GitLab REST API usage beyond the Git protocol itself
Eight-action playbook
The Bee performs eight distinct actions. Each maps to a guide:
| Action |
Guide |
| Interactive rebase (squash, fixup, autosquash) |
guides/01-interactive-rebase.md |
| History rewriting (filter-repo, BFG, secrets removal) |
guides/02-history-rewriting.md |
| Conflict resolution (merge, rebase, rerere) |
guides/03-conflict-resolution.md |
| Reset/reflog recovery |
guides/04-reflog-recovery.md |
| Worktrees for parallel branches |
guides/05-worktrees.md |
| Hooks (pre-commit, commit-msg, pre-push) |
guides/06-hooks.md |
| Large files (Git LFS, partial clone, sparse checkout) |
guides/07-lfs-and-large-files.md |
| Submodules vs subtrees decision |
guides/08-submodules-vs-subtrees.md |
Critical directives (from Command Brief)
These are non-negotiables. Full justifications in guides/00-principles.md.
Always offer the escape hatch before a destructive operation. Before git reset --hard, show git reflog. Before filter-repo, show git bundle create backup.bundle --all. Before any force-push, show the rollback command. The escape hatch must precede the operation.
Prefer --force-with-lease over --force. --force overwrites without checking whether a teammate pushed since your last fetch. --force-with-lease aborts if the remote was updated, preventing silent overwrites. Use --force-with-lease=<refname> for the strictest variant.
Never recommend git filter-branch. It is officially deprecated (Git 2.36+) in favor of git filter-repo. It is an order of magnitude slower, has known correctness bugs, and the manpage now opens with a deprecation warning. Always use filter-repo or BFG.
Confirm the Git version before recommending advanced features. Worktrees stabilized in Git 2.15. Sparse checkout v2 (cone mode) arrived in 2.25. Partial clone landed in 2.22. --rebase-merges in 2.22. --autosquash has been available since 1.7.4 but fixup! with a comment requires 2.32.
Escalate to security-worker-bee for secrets-in-history scenarios. Removing a secret from history requires force-push coordination AND credential rotation - the secret must be treated as compromised even after removal. That coordination (rotating keys, auditing access logs, notifying stakeholders) is security-worker-bee's domain.
Escalate to ci-release-worker-bee for server-side hooks and CI Git configuration. Server-side hooks (pre-receive, update, post-receive) run in CI contexts with different Git versions, file system constraints, and network policies.
Git version requirements matrix
| Feature |
Minimum Git version |
git worktree (stable) |
2.15 |
Partial clone (--filter) |
2.22 |
--rebase-merges |
2.22 |
Sparse checkout v2 (--cone) |
2.25 |
git switch / git restore |
2.23 |
filter-branch deprecated warning |
2.36 |
git bundle --filter |
2.41 |
Check with git --version before using any of the above.
Quick reference: recovery operations
| Scenario |
Command |
| Undo last commit (keep changes staged) |
git reset --soft HEAD~1 |
| Undo last commit (keep changes unstaged) |
git reset HEAD~1 |
| Undo last commit (discard changes) |
git reset --hard HEAD~1 + verify with reflog first |
| Recover deleted branch |
git checkout -b <branch> <sha> (sha from git reflog) |
| Recover dropped stash |
git stash apply <sha> (sha from git fsck --lost-found) |
| Undo a merge |
git reset --hard ORIG_HEAD |
| Undo a rebase |
git reset --hard ORIG_HEAD or find pre-rebase sha in reflog |
| Recover file deleted in past commit |
git checkout <sha>^ -- <path> |
Quick reference: interactive rebase commands
| Command |
Effect |
pick |
Keep commit as-is |
reword |
Keep commit, edit message |
edit |
Keep commit, pause to amend |
squash |
Meld into previous commit, combine messages |
fixup |
Meld into previous commit, discard message |
drop |
Delete commit entirely |
exec |
Run shell command between commits |
break |
Pause rebase at this point |
Folder layout
git-stinger/
├── SKILL.md (this file - master index)
├── README.md (human overview)
├── guides/
│ ├── 00-principles.md (escape-hatch-first, force-with-lease, filter-branch deprecation, version matrix, public-branch rule)
│ ├── 01-interactive-rebase.md (squash, fixup, autosquash, rebase -i conflict resolution)
│ ├── 02-history-rewriting.md (filter-repo, BFG, backup procedure, force-push protocol)
│ ├── 03-conflict-resolution.md (merge conflicts, rerere, mergetool, cherry-pick conflicts)
│ ├── 04-reflog-recovery.md (reset types, recovering deleted branches/commits, ORIG_HEAD)
│ ├── 05-worktrees.md (worktree commands, bare clone pattern, AI agent use cases)
│ ├── 06-hooks.md (pre-commit, commit-msg, pre-push; Husky/lefthook setup)
│ ├── 07-lfs-and-large-files.md (LFS setup, .gitattributes, partial clone, sparse checkout)
│ └── 08-submodules-vs-subtrees.md (decision matrix, lifecycle commands, alternatives)
├── examples/
│ ├── secrets-removal.md (end-to-end: discovered secret → backup → filter-repo → force-push → escalate)
│ └── worktree-parallel-features.md (two features in progress without stash context-switch)
├── templates/
│ ├── gitattributes-starter.md (.gitattributes with LFS patterns + line-ending normalization)
│ ├── hooks-collection.md (pre-commit, commit-msg, pre-push hook scripts)
│ └── rebase-cheatsheet.md (quick-reference card for rebase -i commands)
├── reports/
│ └── README.md (past run summaries accumulate here)
└── research/ (authored by scripture-historian - DO NOT MODIFY)
├── research-plan.md
├── research-summary.md
├── index.md
├── internal/
└── external/
Part of The Hive, curated by Mario Aldayuz a.k.a @thenotoriousllama.
1---2name: git-stinger3description: Git mastery specialist - interactive rebase (squash, fixup, reword, drop), conflict resolution, history rewriting (git filter-repo, BFG), reset/reflog recovery, worktrees for parallel branches, hooks (Husky, lefthook), submodules vs subtrees, Git LFS, partial clone, and sparse checkout. Use when the user says \\\"squash my commits\\\", \\\"I pushed a secret\\\", \\\"my repo is huge\\\", \\\"undo that rebase\\\", \\\"work on two branches at once\\\", \\\"set up Git hooks\\\", \\\"submodules vs subtrees\\\", or needs any Git recovery operation. Do NOT use for CI/CD pipeline configuration (ci-release-worker-bee) or credential rotation after a secrets incident (security-worker-bee).4---56# git Stinger78The procedural arsenal for `git-worker-bee`. This stinger encodes the opinionated playbooks for every Git mastery surface: interactive rebase, conflict resolution, history rewriting, reflog recovery, worktrees, hooks, large-file storage, and submodule/subtree architecture.910**When invoked, read `SKILL.md` first, then the relevant guide(s) for the task at hand. Research files confirm every factual claim; cite them when answering questions.**1112---1314## Scope and non-scope1516**In scope:**17- Branching strategy advisory (trunk-based, Git Flow, GitHub Flow)18- Interactive rebase: squash, fixup, reword, drop, reorder, exec, autosquash19- Conflict resolution: merge conflicts, rebase conflicts, rerere, mergetool config20- History rewriting: `git filter-repo`, BFG Repo Cleaner, removing secrets/large files21- Reset/reflog recovery: all three reset types, recovering deleted branches and commits22- Git worktrees: parallel branch work without stashing23- Hooks: client-side (pre-commit, commit-msg, pre-push) and server-side hand-off24- Submodules vs subtrees decision matrix and lifecycle25- Git LFS: setup, `.gitattributes`, selective fetch, CI patterns26- Partial clone (`--filter=blob:none`) and sparse checkout v2 (`--cone` mode)27- Commit signing: GPG and SSH signature verification2829**Not in scope:**30- CI/CD pipeline configuration using Git events -> ci-release-worker-bee31- Server-side hook configuration in CI/CD runners -> ci-release-worker-bee32- Credential rotation after a secrets-in-history incident -> security-worker-bee33- Secret scanning policies and repository security tooling -> security-worker-bee34- GitHub/GitLab REST API usage beyond the Git protocol itself3536---3738## Eight-action playbook3940The Bee performs eight distinct actions. Each maps to a guide:4142| Action | Guide |43|---|---|44| Interactive rebase (squash, fixup, autosquash) | `guides/01-interactive-rebase.md` |45| History rewriting (filter-repo, BFG, secrets removal) | `guides/02-history-rewriting.md` |46| Conflict resolution (merge, rebase, rerere) | `guides/03-conflict-resolution.md` |47| Reset/reflog recovery | `guides/04-reflog-recovery.md` |48| Worktrees for parallel branches | `guides/05-worktrees.md` |49| Hooks (pre-commit, commit-msg, pre-push) | `guides/06-hooks.md` |50| Large files (Git LFS, partial clone, sparse checkout) | `guides/07-lfs-and-large-files.md` |51| Submodules vs subtrees decision | `guides/08-submodules-vs-subtrees.md` |5253---5455## Critical directives (from Command Brief)5657These are non-negotiables. Full justifications in `guides/00-principles.md`.58591. **Always offer the escape hatch before a destructive operation.** Before `git reset --hard`, show `git reflog`. Before `filter-repo`, show `git bundle create backup.bundle --all`. Before any force-push, show the rollback command. The escape hatch must precede the operation.60612. **Prefer `--force-with-lease` over `--force`.** `--force` overwrites without checking whether a teammate pushed since your last fetch. `--force-with-lease` aborts if the remote was updated, preventing silent overwrites. Use `--force-with-lease=<refname>` for the strictest variant.62633. **Never recommend `git filter-branch`.** It is officially deprecated (Git 2.36+) in favor of `git filter-repo`. It is an order of magnitude slower, has known correctness bugs, and the manpage now opens with a deprecation warning. Always use `filter-repo` or BFG.64654. **Confirm the Git version before recommending advanced features.** Worktrees stabilized in Git 2.15. Sparse checkout v2 (cone mode) arrived in 2.25. Partial clone landed in 2.22. `--rebase-merges` in 2.22. `--autosquash` has been available since 1.7.4 but `fixup!` with a comment requires 2.32.66675. **Escalate to security-worker-bee for secrets-in-history scenarios.** Removing a secret from history requires force-push coordination AND credential rotation - the secret must be treated as compromised even after removal. That coordination (rotating keys, auditing access logs, notifying stakeholders) is security-worker-bee's domain.68696. **Escalate to ci-release-worker-bee for server-side hooks and CI Git configuration.** Server-side hooks (`pre-receive`, `update`, `post-receive`) run in CI contexts with different Git versions, file system constraints, and network policies.7071---7273## Git version requirements matrix7475| Feature | Minimum Git version |76|---|---|77| `git worktree` (stable) | 2.15 |78| Partial clone (`--filter`) | 2.22 |79| `--rebase-merges` | 2.22 |80| Sparse checkout v2 (`--cone`) | 2.25 |81| `git switch` / `git restore` | 2.23 |82| `filter-branch` deprecated warning | 2.36 |83| `git bundle --filter` | 2.41 |8485Check with `git --version` before using any of the above.8687---8889## Quick reference: recovery operations9091| Scenario | Command |92|---|---|93| Undo last commit (keep changes staged) | `git reset --soft HEAD~1` |94| Undo last commit (keep changes unstaged) | `git reset HEAD~1` |95| Undo last commit (discard changes) | `git reset --hard HEAD~1` + verify with reflog first |96| Recover deleted branch | `git checkout -b <branch> <sha>` (sha from `git reflog`) |97| Recover dropped stash | `git stash apply <sha>` (sha from `git fsck --lost-found`) |98| Undo a merge | `git reset --hard ORIG_HEAD` |99| Undo a rebase | `git reset --hard ORIG_HEAD` or find pre-rebase sha in reflog |100| Recover file deleted in past commit | `git checkout <sha>^ -- <path>` |101102---103104## Quick reference: interactive rebase commands105106| Command | Effect |107|---|---|108| `pick` | Keep commit as-is |109| `reword` | Keep commit, edit message |110| `edit` | Keep commit, pause to amend |111| `squash` | Meld into previous commit, combine messages |112| `fixup` | Meld into previous commit, discard message |113| `drop` | Delete commit entirely |114| `exec` | Run shell command between commits |115| `break` | Pause rebase at this point |116117---118119## Folder layout120121```text122git-stinger/123├── SKILL.md (this file - master index)124├── README.md (human overview)125├── guides/126│ ├── 00-principles.md (escape-hatch-first, force-with-lease, filter-branch deprecation, version matrix, public-branch rule)127│ ├── 01-interactive-rebase.md (squash, fixup, autosquash, rebase -i conflict resolution)128│ ├── 02-history-rewriting.md (filter-repo, BFG, backup procedure, force-push protocol)129│ ├── 03-conflict-resolution.md (merge conflicts, rerere, mergetool, cherry-pick conflicts)130│ ├── 04-reflog-recovery.md (reset types, recovering deleted branches/commits, ORIG_HEAD)131│ ├── 05-worktrees.md (worktree commands, bare clone pattern, AI agent use cases)132│ ├── 06-hooks.md (pre-commit, commit-msg, pre-push; Husky/lefthook setup)133│ ├── 07-lfs-and-large-files.md (LFS setup, .gitattributes, partial clone, sparse checkout)134│ └── 08-submodules-vs-subtrees.md (decision matrix, lifecycle commands, alternatives)135├── examples/136│ ├── secrets-removal.md (end-to-end: discovered secret → backup → filter-repo → force-push → escalate)137│ └── worktree-parallel-features.md (two features in progress without stash context-switch)138├── templates/139│ ├── gitattributes-starter.md (.gitattributes with LFS patterns + line-ending normalization)140│ ├── hooks-collection.md (pre-commit, commit-msg, pre-push hook scripts)141│ └── rebase-cheatsheet.md (quick-reference card for rebase -i commands)142├── reports/143│ └── README.md (past run summaries accumulate here)144└── research/ (authored by scripture-historian - DO NOT MODIFY)145 ├── research-plan.md146 ├── research-summary.md147 ├── index.md148 ├── internal/149 └── external/150```151152---153154*Part of The Hive, curated by [Mario Aldayuz a.k.a @thenotoriousllama](https://github.com/thenotoriousllama).*