← ClaudeAtlas

git-change-control-for-agentslisted

Use when doing any git work: cutting a branch, opening a PR, merging parallel work, or resuming work in a repo you didn't just leave. Covers state verification before acting, the dead-base PR trap, migration-number collisions, working-tree discipline, and how to handle a product decision that surfaces mid-task.
HamzaYM/reliable-ai-skills · ★ 0 · AI & Automation · score 67
Install: claude install-skill HamzaYM/reliable-ai-skills
# Git change control for agents Agentic git work fails in specific, recurring ways that human muscle-memory usually avoids by accident: trusting a branch's state instead of checking it, building a PR on a base that's secretly already dead, and treating "clean up the working tree" as safe when it isn't. This skill is the checklist against all of them. ## Step 0: determine current state every time, never trust what you inherit Never assume the checkout you're starting from reflects the true remote state, and never act on remembered sequencing from an earlier session. At the start of any branch/PR work: ```bash git fetch origin git status --short --branch git log --oneline -1 origin/main git log --branches --not --remotes --oneline # local-only, unpushed work gh pr list --state open --json number,title,headRefName,baseRefName git worktree list ``` Decision gates: - **On the main/trunk branch** → never work here directly; branch first. - **Your current branch is already merged into the trunk** (its tip is an ancestor of the trunk's tip, and isn't the trunk tip itself) → don't commit more here; cut a fresh branch from the trunk instead. - **Local trunk is behind the remote trunk** → never branch from local trunk; branch from the fetched remote tip. - **Unrecognized dirty or untracked files** → don't stash or discard them; they may not be yours. Ask before touching anything you didn't create. ## The dead-base PR trap Stacking a PR on another feature branch as its base, ins