git
claudePuts a project's git into a known-good state before the first prompt of every session, for any git repository. At SessionStart it runs two steps in order, in one process: (1) fetch every branch and tag from the remote and prune stale branch and tag refs, so remote-tracking refs match the remote; then (2) attach the worktree - fast-forward the branch this tree is on to the remote's default branch (main, falling back to master) using those just-fetched refs, and populate, attach, and fast-forward every top-level submodule to the superproject's recorded gitlink. Fast-forward only: a diverged or dirty branch is left exactly as it is. Submodule population is top-level only by default; set GIT_PLUGIN_SUBMODULE_INIT_RECURSIVE to 1 or true to also populate every nested submodule beneath them (still no branch or gitlink sync for those). Does nothing outside a git repo or in a repo with no remote, never fails a session (always exits 0), and injects one attached-mode summary line for the agent only when the attach step ran. Each step has its own off switch (GIT_PLUGIN_GIT_FETCH_DISABLED, GIT_PLUGIN_WORKTREE_ATTACHED_MODE_DISABLED); any non-empty value disables that step. The latest launch status is kept per session under the OS temp dir and reported on demand by the read-only launch-status skill, which also shows the attached branch and commit ids of the superproject, origin/main (or origin/master), local main (or master), and each submodule; a read-only recap skill reports branch/tracking-remote/PR state for the superproject and each top-level submodule.
2 skills · hooks