fix(git): restore router coverage and commands the retrofit dropped
git-workflow calls itself a router but named two of the six domains it routes to; the other four appeared nowhere in the file. All six are now named, with a routing table in the always-loaded body. git-submodules lost the foreach shell-variable semantics -- only the bare names survived, though $sm_path and $displaypath differ solely by which directory you are in. The table is back. Its relocated commands had also dropped the rtk git prefix its own SKILL.md mandates; 24 of them are re-prefixed. The wider rtk inconsistency across the plugin stays with #113. Also restores git-commits' body and footers output fields, git-branches' tag/ branch detection commands, git-worktrees' git config --worktree, pc-run's ambiguity fallback, git-remotes' git-history boundary, and git-history's pickaxe triggers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJJrm5YmacbwMdzZpXcoti
This commit is contained in:
@@ -10,8 +10,9 @@ One file per task branch in SKILL.md's dispatch table. Load only the one that ma
|
||||
## setup-and-update.md
|
||||
|
||||
Cloning a superproject that has submodules, adding a dependency as a submodule, initializing
|
||||
without cloning, and updating or re-pinning. Carries the `add` and `update` flag tables and the
|
||||
keep-pinned and move-the-pin-forward workflows.
|
||||
without cloning, updating or re-pinning, and running one command across every submodule. Carries
|
||||
the `add` and `update` flag tables, the keep-pinned and move-the-pin-forward workflows, and the
|
||||
`foreach` shell-variable table (`$name`, `$sm_path`, `$displaypath`, `$sha1`, `$toplevel`).
|
||||
|
||||
## urls-and-config.md
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Both operations are destructive. Confirm with the user before executing either.
|
||||
## `deinit` is not removal
|
||||
|
||||
```bash
|
||||
git submodule deinit <path> # --all for every submodule, -f if locally modified
|
||||
rtk git submodule deinit <path> # --all for every submodule, -f if locally modified
|
||||
```
|
||||
|
||||
`deinit` clears the submodule's section from `.git/config` and empties its working tree. The
|
||||
@@ -22,11 +22,11 @@ or to reset a broken checkout, not to delete a dependency.
|
||||
## Full removal, in order
|
||||
|
||||
```bash
|
||||
git submodule deinit -f <path> # unregister from .git/config
|
||||
git rm <path> # drop the .gitmodules entry and the gitlink from the index
|
||||
rm -rf .git/modules/<name>/ # stale git dir: not tracked, not cleaned up by git
|
||||
git commit -m "chore: remove <name> submodule"
|
||||
rtk git submodule deinit -f <path> # unregister from .git/config
|
||||
rtk git rm <path> # drop the .gitmodules entry and the gitlink from the index
|
||||
rm -rf .git/modules/<name>/ # stale git dir: not tracked, not cleaned up by git
|
||||
rtk git commit -m "chore: remove <name> submodule"
|
||||
```
|
||||
|
||||
The third step is the one that gets skipped. `.git/modules/<name>/` survives `git rm`, and while it
|
||||
The third step is the one that gets skipped. `.git/modules/<name>/` survives `rtk git rm`, and while it
|
||||
is present Git refuses to add a submodule at the same path again.
|
||||
|
||||
@@ -9,16 +9,16 @@ source_keys:
|
||||
## Clone a superproject that already has submodules
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules <url> # Git 2.13+, one step
|
||||
rtk git clone --recurse-submodules <url> # Git 2.13+, one step
|
||||
# or, against an existing clone
|
||||
git submodule update --init --recursive
|
||||
rtk git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## Add a dependency as a submodule
|
||||
|
||||
```bash
|
||||
git submodule add <url> <path>
|
||||
git commit -m "chore: add <name> as submodule"
|
||||
rtk git submodule add <url> <path>
|
||||
rtk git commit -m "chore: add <name> as submodule"
|
||||
```
|
||||
|
||||
`add` stages a `.gitmodules` entry and a gitlink — the commit is still required. Flags:
|
||||
@@ -32,14 +32,14 @@ git commit -m "chore: add <name> as submodule"
|
||||
|
||||
## Initialize without cloning
|
||||
|
||||
`git submodule init [<path>...]` copies submodule URLs from `.gitmodules` into `.git/config` and
|
||||
`rtk git submodule init [<path>...]` copies submodule URLs from `.gitmodules` into `.git/config` and
|
||||
does nothing else. This is the point at which a local URL override can be edited before any fetch
|
||||
happens. If a local mirror override is wanted, read `references/urls-and-config.md` before running
|
||||
`update`. Use `update --init` to run both steps at once.
|
||||
|
||||
## Update
|
||||
|
||||
`git submodule update --init --recursive` is the common case: it clones what is missing and checks
|
||||
`rtk git submodule update --init --recursive` is the common case: it clones what is missing and checks
|
||||
out the commit the superproject recorded, in detached HEAD.
|
||||
|
||||
| Flag | Meaning |
|
||||
@@ -59,16 +59,38 @@ out the commit the superproject recorded, in detached HEAD.
|
||||
## Keep submodules pinned to the recorded commit
|
||||
|
||||
```bash
|
||||
git submodule update --recursive # after every git pull
|
||||
git config submodule.recurse true # or do it automatically on pull/push/checkout
|
||||
rtk git submodule update --recursive # after every rtk git pull
|
||||
rtk git config submodule.recurse true # or do it automatically on pull/push/checkout
|
||||
```
|
||||
|
||||
## Move the pin forward to the tracked branch tip
|
||||
|
||||
```bash
|
||||
git submodule update --remote --merge --recursive
|
||||
git commit -am "chore: update submodules to latest"
|
||||
rtk git submodule update --remote --merge --recursive
|
||||
rtk git commit -am "chore: update submodules to latest"
|
||||
```
|
||||
|
||||
`--remote` requires `submodule.<name>.branch`; without it Git falls back to the remote's default
|
||||
branch. Commit the superproject afterwards or the new pin is lost on the next `update`.
|
||||
|
||||
## Run one command across every submodule
|
||||
|
||||
```bash
|
||||
rtk git submodule foreach --recursive '<command>'
|
||||
rtk git submodule foreach 'git pull origin main || :' # || : continues past a failure
|
||||
```
|
||||
|
||||
`<command>` runs inside each submodule's own working tree, so the git calls in it are the
|
||||
submodule's own — that is the one place a bare `git` is correct. Append `|| :` to keep the
|
||||
traversal going instead of aborting at the first failure.
|
||||
|
||||
Git exports five shell variables into `<command>`. `$sm_path` and `$displaypath` name the same
|
||||
directory from different vantage points and are not interchangeable:
|
||||
|
||||
| Variable | Meaning |
|
||||
|---|---|
|
||||
| `$name` | Logical submodule name (the `.gitmodules` section name, which need not match the path) |
|
||||
| `$sm_path` | Path relative to the superproject root |
|
||||
| `$displaypath` | Path relative to the current working directory |
|
||||
| `$sha1` | Commit SHA the superproject has recorded for this submodule |
|
||||
| `$toplevel` | Absolute path of the superproject's root |
|
||||
|
||||
@@ -10,7 +10,7 @@ source_keys:
|
||||
|
||||
- **`.gitmodules`** — version-controlled, shared with collaborators. Defines each submodule's
|
||||
logical name, path, and canonical URL.
|
||||
- **`.git/config`** — local only, populated by `git submodule init`. Local URL overrides live here
|
||||
- **`.git/config`** — local only, populated by `rtk git submodule init`. Local URL overrides live here
|
||||
and never propagate to another clone.
|
||||
|
||||
The submodule's own `.git` directory lives at `.git/modules/<name>/` in the superproject and is
|
||||
@@ -38,9 +38,9 @@ linked to the submodule's working tree by a `.git` pointer file.
|
||||
## Rebind a URL or branch
|
||||
|
||||
```bash
|
||||
git submodule sync --recursive # push .gitmodules URLs into .git/config
|
||||
git submodule set-url <path> <url> # change the canonical URL
|
||||
git submodule set-branch -b <branch> <path> # set the branch used by update --remote
|
||||
rtk git submodule sync --recursive # push .gitmodules URLs into .git/config
|
||||
rtk git submodule set-url <path> <url> # change the canonical URL
|
||||
rtk git submodule set-branch -b <branch> <path> # set the branch used by update --remote
|
||||
```
|
||||
|
||||
Run `sync` after an upstream rename: existing clones keep the stale URL in `.git/config` until
|
||||
@@ -49,9 +49,9 @@ they do.
|
||||
## Override a URL locally (private mirror)
|
||||
|
||||
```bash
|
||||
git submodule init
|
||||
rtk git submodule init
|
||||
# edit .git/config: submodule.<name>.url = <mirror-url>
|
||||
git submodule update
|
||||
rtk git submodule update
|
||||
```
|
||||
|
||||
Local-only, invisible to collaborators, and overwritten by the next `sync`.
|
||||
@@ -65,15 +65,15 @@ everywhere else.
|
||||
## Custom `update` commands are security-gated
|
||||
|
||||
A `.gitmodules` entry of `update = !some-command` is never copied into `.git/config` by
|
||||
`git submodule init`. That is deliberate: it stops a hostile clone from silently executing
|
||||
`rtk git submodule init`. That is deliberate: it stops a hostile clone from silently executing
|
||||
arbitrary code. Setting it locally in `.git/config` is the only way to enable it.
|
||||
|
||||
## Relocate an embedded `.git` directory
|
||||
|
||||
```bash
|
||||
git submodule absorbgitdirs [<path>...]
|
||||
rtk git submodule absorbgitdirs [<path>...]
|
||||
```
|
||||
|
||||
Moves a submodule's own `.git` directory into `.git/modules/<name>/` and leaves a `.git` pointer
|
||||
file behind. Needed when a nested repository was created or copied in without going through
|
||||
`git submodule add`.
|
||||
`rtk git submodule add`.
|
||||
|
||||
Reference in New Issue
Block a user