agentleFS
blockedbyblockedby/git-branching-skill/SKILL.md

git-branching

Skill0 starsChanged 51 days agoMITView on GitHub

Use when preparing, finalizing, merging, or synchronizing feature branches and worktrees through a safe PR-first workflow with an explicit target branch.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. DataArt/artisyn-log-hub★ 12same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

25 rules. About 0 are common, 14 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use this skill after the work is implemented and freshly verified, when the feature branch is ready to be aligned with its target branch …

    line 11
  2. Distinctive:

    Default base branch for top-level work: explicit user/repository target.

    line 15
  3. Distinctive:

    Default base branch for delegated child work: the parent task branch.

    line 16
  4. Distinctive:

    Default purpose: isolation for meaningful implementation work.

    line 17
  5. Very specific:

    Use a 15-second wall-clock timeout for direct gh operations by default.

    line 19
  6. Distinctive:

    Follow the target repository's Git instructions when they are stricter or more specific.

    line 23
  7. Distinctive:

    When finalization requires creating or naming a feature, PR, or worktree branch, choose and validate this form:

    line 25
  8. Distinctive:

    Before making any fix-up commit during rebase or conflict resolution, choose and validate a Conventional Commit subject:

    line 33
  9. Distinctive:

    If the user supplies a nonconforming branch name or commit subject, ask for confirmation or suggest a corrected conventional value before …

    line 43
  10. Very specific:

    Keep the primary checkout on <target-branch>.

    line 48
  11. Distinctive:

    Run fresh proving verification for the current branch state.

    line 49
  12. Distinctive:

    Read the script output and decide the verification next step:

    line 52
  13. Very specific:

    if rerun_required=true, run fresh regression verification now

    line 53
  14. Distinctive:

    if you add new fix-up commits after rebase fallout, apply the naming and commit guardrails above before committing, then rerun fresh …

    line 54
  15. Very specific:

    If gh pr view <N> --json state reports state=MERGED, skip merge and continue with local sync / cleanup reporting.

    line 56
  16. Very specific:

    If merge is authorized, move to the checkout holding <target-branch> and run gh pr merge <N> --squash.

    line 57
  17. Very specific:

    Use .worktrees/ at the repository root as default.

    line 63
  18. Very specific:

    Verify .worktrees/ is ignored before creating a new worktree.

    line 64
  19. Distinctive:

    Create the branch from the intended base branch.

    line 65
  20. Very specific:

    Create the worktree under .worktrees/<branch-or-topic>.

    line 66
  21. Distinctive:

    Do not send a child branch directly to the repository target branch unless it is explicitly promoted to independent top-level work.

    line 75
  22. Very specific:

    Never run gh pr merge from a feature worktree.

    line 87
  23. Very specific:

    Never pass --delete-branch to gh pr merge.

    line 88
  24. Distinctive:

    Keep the remote feature branch after merge unless the user explicitly asks to delete it.

    line 89
  25. Very specific:

    Run the sync helper from the worktree where <target-branch> is checked out.

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git Branching

Overview

Use this skill after the work is implemented and freshly verified, when the feature branch is ready to be aligned with its target branch and finalized.

Determine the target branch from the PR base or explicit task context; do not assume it is main. Treat PR creation as the first finish milestone. After the PR exists, prepare the feature branch against origin/<target-branch>, decide whether regression verification must be rerun, and merge from the checkout holding the target branch only when authorized.

  • Default base branch for top-level work: explicit user/repository target; otherwise stop rather than guessing.
  • Default base branch for delegated child work: the parent task branch.
  • Default purpose: isolation for meaningful implementation work.

Use a 15-second wall-clock timeout for direct gh operations by default.

Git naming and commits

Follow the target repository's Git instructions when they are stricter or more specific. Otherwise, use these defaults. Do not rename existing branches or amend, squash, or otherwise rewrite existing commits merely to satisfy these conventions unless explicitly asked.

When finalization requires creating or naming a feature, PR, or worktree branch, choose and validate this form:

<type>/<short-lowercase-kebab-slug>

Allowed default types are feat, fix, docs, chore, refactor, test, ci, build, perf, hotfix, and release. Use a concise lowercase slug containing only letters, numbers, dots, and hyphens. Do not create vague or non-conventional names such as update, updates, changes, work, wip, temp, fixes, agent, or an unprefixed task name. If the correct type is unclear, stop and ask rather than inventing one.

Before making any fix-up commit during rebase or conflict resolution, choose and validate a Conventional Commit subject:

<type>[optional scope]: <imperative summary>

Allowed default types are feat, fix, docs, chore, refactor, test, ci, build, perf, and revert. Keep the summary specific, imperative, and lowercase unless a proper noun or code token requires otherwise. Reject vague subjects such as update, updates, changes, fix, fixes, fix stuff, wip, misc, or checkpoint.

Before any fix-up git commit, inspect the staged state with git status --short and a staged diff or stat such as git diff --cached --stat; confirm the staged change is coherent and the subject accurately describes it. Put the validated subject in the command. Use an editor-based commit only when the user explicitly requests it.

If the user supplies a nonconforming branch name or commit subject, ask for confirmation or suggest a corrected conventional value before proceeding; do not silently substitute it.

Feature Workflow

  1. Determine <target-branch> from the PR base or explicit task context. Use main only when it is actually the target.
  2. Keep the primary checkout on <target-branch>. In the feature worktree, confirm the current branch is not <target-branch>; never finish by checking <target-branch> out inside a feature worktree.
  3. Run fresh proving verification for the current branch state.
  4. Open or update the PR to <target-branch>. Record the PR URL, number, target branch, and intended owner/repo. If fork/upstream ambiguity exists, use gh ... --repo owner/repo for every PR/check operation rather than relying on the worktree remote or a numeric PR alone.
  5. Resolve scripts/prepare-target-branch.sh relative to the directory containing this SKILL.md. Keep the feature worktree as the current working directory and run bash "<resolved-skill-directory>/scripts/prepare-target-branch.sh" --base "<target-branch>".
  6. Read the script output and decide the verification next step:
    • if rerun_required=true, run fresh regression verification now
    • if you add new fix-up commits after rebase fallout, apply the naming and commit guardrails above before committing, then rerun fresh verification again after those commits
  7. Push the refreshed branch.
  8. If gh pr view <N> --json state reports state=MERGED, skip merge and continue with local sync / cleanup reporting. In fork/upstream-ambiguous contexts, run this as gh pr view <N> --repo owner/repo --json state.
  9. If merge is authorized, move to the checkout holding <target-branch> and run gh pr merge <N> --squash. In fork/upstream-ambiguous contexts, include --repo owner/repo.
  10. From that target-branch checkout, resolve scripts/sync-target-branch.sh relative to this skill directory and run bash "<resolved-skill-directory>/scripts/sync-target-branch.sh" --base "<target-branch>" --delete-worktree "<feature-worktree-path>" --delete-branch "<feature-branch>".
  11. Report the PR URL, target branch, rebase result, verification result, merge result, cleanup result, and any stash label used to preserve target-checkout state.

Worktree Workflow

  1. Use .worktrees/ at the repository root as default. Check for project-level worktrees rules.
  2. Verify .worktrees/ is ignored before creating a new worktree.
  3. Create the branch from the intended base branch.
  4. Create the worktree under .worktrees/<branch-or-topic>.
  5. Report the resulting path and branch clearly.

Worktrees for delegated child work

For delegated implementation that belongs to a parent task, default to the parent branch/worktree as the base, not the repository target branch. The child branch remains part of the parent task until integrated.

Child results should merge or otherwise integrate back into the parent worktree/branch first. The parent task owner decides the parent done-state, resolves overlap, reruns needed verification, and prepares the parent branch/PR to the target branch.

Do not send a child branch directly to the repository target branch unless it is explicitly promoted to independent top-level work.

Re-run regression rules

  • Re-run when prepare-target-branch.sh reports content_changed=true.
  • Re-run when the rebase required conflict resolution.
  • Re-run whenever new fix-up commits were added after rebase fallout.
  • Skip the second run only when the rebase was a no-op / metadata-only update and no new commits were added afterward.

Merge rules

  • Merge only when the user asked for autonomous completion or task policy clearly allows it.
  • Never run gh pr merge from a feature worktree; use the checkout holding the target branch.
  • Never pass --delete-branch to gh pr merge.
  • Keep the remote feature branch after merge unless the user explicitly asks to delete it.

Target-branch sync rules

  • Run the sync helper from the worktree where <target-branch> is checked out.
  • Dirty target-checkout state may be stashed, synced, and restored automatically.
  • sync-target-branch.sh must report the stash label and stop without dropping it if stash restore conflicts appear.

Helper scripts

  • scripts/prepare-target-branch.sh — feature-branch fetch / rebase / status helper
  • scripts/sync-target-branch.sh — target-checkout sync / stash restore / local cleanup helper

Resolve both paths relative to the directory containing this SKILL.md, not relative to the target repository.

Common mistakes

  • merging before opening the PR
  • rebasing before the PR exists
  • treating stale pre-rebase verification as enough after branch content changed
  • merging from a feature worktree
  • deleting the remote branch out of habit
  • assuming the target branch is main without checking the PR base or task context
  • switching the feature worktree to the target branch as a finish step
  • creating a worktree without checking ignore safety

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.