git-workflows
Use when managing branches, writing commits, creating isolated worktrees for feature work, or resolving and verifying merge/rebase conflicts.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- git-workflows
- triggers
- [ "user", "model" ]
- description
- Use when managing branches, writing commits, creating isolated worktrees for feature work, or resolving and verifying merge/rebase conflicts.
03 SKILL.md 正文
Git Workflows
Branches, commits, isolated worktrees, and merge-conflict resolution.
Branches & commits
git checkout -b feature/<name>/git push -u origin feature/<name>.- Conventional commits:
type(scope): description— feat, fix, docs, style, refactor, test, chore. Subject ≤72 chars; atomic commits (one logical change). - Pull latest before branching; prefixes: feature/, bugfix/, hotfix/.
- Cleanup:
git remote prune origin,git branch -d <name>.
Worktrees (isolated workspaces)
Core principle: detect existing isolation → prefer native tools → git fallback. Never fight the harness.
Step 0 — detect existing isolation:
GIT_DIR=$(cd "$(git rev-parse --git-dir)" && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" && pwd -P)
git rev-parse --show-superproject-working-tree 2>/dev/null # submodule guard
GIT_DIR != GIT_COMMON and not a submodule → already in a linked worktree;
skip creation. In a submodule → treat as normal repo.
Step 1a — native worktree tool preferred (EnterWorktree, /worktree,
--worktree flag): use it — it owns placement, branching, cleanup. Manual
git worktree add alongside a native tool creates phantom state.
Step 1b — git fallback (no native tool): pick directory in priority
order — explicit user instruction → existing .worktrees/ → worktrees/ →
default .worktrees/. MUST git check-ignore -q <dir> first; if not
ignored, add to .gitignore and commit. Then:
git worktree add "$path" -b "$BRANCH_NAME" && cd "$path"
Permission error → sandbox fallback: work in place.
Step 2 — setup: auto-detect (package.json→npm install, Cargo.toml→cargo build, requirements.txt/pyproject.toml→pip/poetry, go.mod→go mod download).
Step 3 — baseline: run project tests; failures → report + ask, passes → "Worktree ready at <path>, <N> tests passing".
Rationalizations to reject: "obviously not in a worktree" (run Step 0), "worktree add is quicker" (native tool owns lifecycle), "surely ignored" (run check-ignore), "baseline can wait" (dirty baseline makes later failures ambiguous).
Multiple lanes (parallel agents)
For risky refactors, spikes, or parallel subagents, manage each worktree as a named lane; the controller (orchestrator) owns lane planning, branch/path selection, file ownership, delegation, diff validation, integration, and cleanup. Subagents work inside their assigned lane only.
- Lane manifest: optional local metadata
.devin/worktrees.jsontrackingslug,branch,path,base,purpose,owner,status,areas(file/folder ownership),createdAt. Treat as local workflow metadata; ask before committing it to the repo. - File ownership per lane: record which paths each lane owns so parallel agents do not collide; a lane that needs another lane's area stops and reports instead of editing across boundaries.
- Subagent isolation: set each subagent's working directory strictly to its lane path; never modify the main checkout for lane work.
- Managed ignore blocks: when a project convention tracks worktree
dirs in
.gitignore, add them insideBEGIN/ENDmanaged markers and add only missing lines; never duplicate or rewrite unrelated rules. - Mandatory confirmation before git mutations: worktree add/remove,
branch create/delete/rename, merge, rebase, cherry-pick, prune, and any
destructive command (
reset --hard,clean,push --force, removing a dirty worktree) each need explicit user confirmation for that operation. - Integration: before merging a lane: run verification proportional to the changed behavior, show the diff against the integration base, and get user confirmation. Integrate from the main checkout.
- Cleanup: confirm no uncommitted changes, get approval, remove the
worktree, and mark the lane
archivedin the manifest.
Skip lanes for: single-file changes, doc updates, minor fixes, and repos with multi-submodule states worktrees cannot express.
Merge conflicts
- See the state — merge/rebase status, history, conflicting files.
- Find primary sources — why each change was made: commit messages, PRs,
original issues (
ghfor GitHub). - Resolve each hunk — preserve both intents where possible; where
incompatible, pick the one matching the merge's stated goal and note the
trade-off. Don't invent new behavior. Always resolve; never
--abort. - Run the project's checks — typecheck, tests, format. Fix what the merge broke.
- Finish — stage, commit;
git rebase --continueuntil done if rebasing.
Cross-skills
finishing-a-development-branch— when the branch/worktree is done.handoff— pause and resume in a fresh session.gh— read PRs/issues behind conflicting changes.adaptive-agenda-calendar-routine-engine- Stage 5 versioned delivery (commits, PRs, issue wiring) delegates here together withgh,pr,finishing-a-development-branch.git-github-adaptive-engineering- orchestrates flow choice and Fase Zero repo-state checks; this skill executes the branch/commit/worktree depth.
04 同仓库更多 Skills
montador-de-ideias
Use when assembling, expanding, or elevating a raw project idea or initial prompt into an ultra-detailed, first-principles dossier and compiled master prompt with journalistic OSINT market research, Tech Lead and Staff Architect justifications, atomic and modular hardening/optimization, and high-impact contact surfaces.
git-github-adaptive-engineering
Use when any task touches git history, GitHub issues/PRs/releases/CI, repo governance, or branch and merge decisions. Runs the Fase Zero situational-awareness battery, picks one of five delivery flows via the adaptive decision engine, and enforces commit/PR information-density standards. Orchestrates the gh, git-workflows, github-actions, pr, and debug/finish skills.
adaptive-agenda-calendar-routine-engine
Use when planning or executing work across hours, days, weeks, or sprints. Turns the calendar into a strict time-blocked agenda (HH:MM-HH:MM blocks carrying a routine profile, expected inputs, and a handoff output artifact), runs the 5-stage cognitive flow (Radar and Hunt -> Triage plus Steve Jobs conception -> workbench manifest -> >=32-cycle loop -> Close plus Open-Minded Scrum), and unfolds macro calendar milestones into micro agenda blocks through extensions/gcal/wrapper.py.
demo
Use when demonstrating a skill in a fixture project.
duplicate-skill
Use when testing duplicate skill name detection.
duplicate-skill
Use when testing duplicate skill name detection.