gitkit

Manages git worktrees, base-ref resolution, branch syncing, cleanup, and recovery using native git commands.

1|Updated Jul 12, 2026
One-click install
npx skills add https://github.com/mimukit/skills --skill gitkit-mimukit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gitkit
Source: https://github.com/mimukit/skills/tree/main/skills/gitkit
Command: npx skills add https://github.com/mimukit/skills --skill gitkit-mimukit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams repeatedly re-derive the same git decisions: where a worktree should live, which branch is the base, whether to rebase or merge, and how to recover lost commits. This Skill centralizes those answers as one shared git layer so every other workflow skill and every developer gets identical, correct behavior on any machine. ## Core Features & Use Cases - Worktree lifecycle: Create, adopt, look up, list, and remove worktrees under a single convention ($WORKTREE_ROOT/<repo>/<branch>), enforcing one worktree per branch with idempotent, non-destructive teardown. - Base ref and sync: Resolve the true default branch through a five-step ladder, then sync feature branches with a rebase-first policy, one confirmation covering rebase plus --force-with-lease push, and unresolved review-thread counts disclosed up front. - Clean, rescue, and stack modes: Sweep merged worktrees and branches with squash-merge detection, recover lost commits from reflogs and ORIG_HEAD via additive branch restores, and manage stacked branches through the gh stack extension with plain-git degradation. - Use Case: A developer says "sync this branch with main" — the Skill fetches, rebases onto the resolved base, runs the repo's test gate, and force-pushes with a lease, reporting exactly what changed. ## Quick Start Ask the agent to spin up a worktree for issue 42 and sync my current branch with the base branch.

Frequently Asked Questions about gitkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a git worktree for a feature branch?

Fetch origin first, then run git worktree add -b <branch> under $WORKTREE_ROOT/<repo>/<branch> from the resolved base ref. If a worktree already exists for that branch, adopt it and report the path instead of creating a second one.

Should I rebase or merge to sync a feature branch with main?

Rebase onto the base by default, even for published branches, so the branch reads as a linear sequence of its own commits. Merging the base in is an exception requiring a stated reason, such as unresolved review threads that a force-push would mark outdated.

How do I find the default base branch of a repository?

Query gh repo view --json defaultBranchRef first, then fall back to git symbolic-ref refs/remotes/origin/HEAD, repair it with git remote set-head origin --auto, check origin/main or origin/master, and ask the user only after all of those fail.

Why does git branch --merged miss squash-merged branches?

A squash merge writes one new commit with no parent link to the branch, so ancestry checks report it as unmerged. Detect it by comparing the branch's combined patch-id against commits on the base using git patch-id --stable.

How do I recover a commit lost after a bad rebase or reset?

Check git status for an in-progress rebase and abort it, then search the HEAD and branch reflogs, ORIG_HEAD, and the stash list. Restore by creating a new branch at the chosen SHA rather than moving any existing ref, and never run git gc or prune during recovery.

Can I use stacked branches without the gh stack extension?

Yes, the topology is reproducible with plain git: create each layer with git switch -c from the parent branch and open pull requests targeting the parent with gh pr create --base. You lose the stack map, automatic restacking, and cascade merging.