refactor(git): normalize rtk-prefix usage, add metadata.version
Two bundled fixes across the same nine skills, since both touch the same files. Issue #113: skill prose used rtk git and bare git inconsistently for the same operations, with no stated rule for which applied where. Executable instructed commands (a dispatch-table "Run" cell, a fenced code-block procedure, an imperative step) now consistently use rtk git; illustrative or referential mentions -- naming a flag's behavior, quoting a doc heading, warning against an anti-pattern -- stay bare git. Documented in the new plugins/git/README.md, scoped to this plugin only: gitea-* skills talk to the server over MCP tools and carry no git/rtk mentions at all. Also the git-plugin slice of #127: metadata.version added to the eight skills that lacked it. git-commits already had one and is untouched. Fixes: #113 Fixes: #127 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EeH8SCbcrCAQrtymkNuhKP
This commit is contained in:
@@ -9,14 +9,14 @@ source_keys:
|
||||
|
||||
Default: safe push to the same-named branch on the remote.
|
||||
|
||||
- **Force-push**: never bare `--force`. Use `git push --force-with-lease --force-if-includes <remote> <branch>`, after the SKILL.md Step 1 gate.
|
||||
- **Basic**: `git push <remote> <branch>`
|
||||
- **Set upstream**: `git push -u <remote> <branch>` — push and configure tracking
|
||||
- **Multi-remote**: push sequentially (`git push origin develop`, `git push staging develop`), or add a second push URL with `git remote set-url --add <name> <url>` to reach both in one command
|
||||
- **Delete a remote branch**: `git push <remote> --delete <branch>` — clearer than the `:<branch>` form
|
||||
- **Bulk**: `git push --all` (all local branches), `git push --tags` (all tags), `git push origin <tag>` (one tag)
|
||||
- **Delete remote branches with no local counterpart**: `git push --prune origin 'refs/heads/*:refs/heads/*'`
|
||||
- **Force only part of a multi-ref push**: prefix the one refspec that needs it with `+` — `git push origin +release develop` forces `release` while safe-pushing `develop`. A `+` prefix is a force-push and passes the SKILL.md Step 1 gate like any other.
|
||||
- **Force-push**: never bare `--force`. Use `rtk git push --force-with-lease --force-if-includes <remote> <branch>`, after the SKILL.md Step 1 gate.
|
||||
- **Basic**: `rtk git push <remote> <branch>`
|
||||
- **Set upstream**: `rtk git push -u <remote> <branch>` — push and configure tracking
|
||||
- **Multi-remote**: push sequentially (`rtk git push origin develop`, `rtk git push staging develop`), or add a second push URL with `rtk git remote set-url --add <name> <url>` to reach both in one command
|
||||
- **Delete a remote branch**: `rtk git push <remote> --delete <branch>` — clearer than the `:<branch>` form
|
||||
- **Bulk**: `rtk git push --all` (all local branches), `rtk git push --tags` (all tags), `rtk git push origin <tag>` (one tag)
|
||||
- **Delete remote branches with no local counterpart**: `rtk git push --prune origin 'refs/heads/*:refs/heads/*'`
|
||||
- **Force only part of a multi-ref push**: prefix the one refspec that needs it with `+` — `rtk git push origin +release develop` forces `release` while safe-pushing `develop`. A `+` prefix is a force-push and passes the SKILL.md Step 1 gate like any other.
|
||||
|
||||
## Refspec syntax — `[+]<src>[:<dst>]`
|
||||
|
||||
@@ -48,19 +48,19 @@ Two mitigations:
|
||||
# Option 1 — dedicated push-only remote: background tools fetch `origin`, you push
|
||||
# through a separate remote that nothing else touches, so its tracking ref can't be
|
||||
# poisoned by an unrelated fetch.
|
||||
git remote add origin-push $(git config remote.origin.url)
|
||||
git push --force-with-lease origin-push
|
||||
rtk git remote add origin-push $(rtk git config remote.origin.url)
|
||||
rtk git push --force-with-lease origin-push
|
||||
|
||||
# Option 2 — explicit SHA via a local tag, unaffected by tracking-branch state
|
||||
git fetch
|
||||
git tag base master
|
||||
git rebase -i master
|
||||
git push --force-with-lease=master:base master:master
|
||||
rtk git fetch
|
||||
rtk git tag base master
|
||||
rtk git rebase -i master
|
||||
rtk git push --force-with-lease=master:base master:master
|
||||
```
|
||||
|
||||
`--force-if-includes` adds a second check on top of bare `--force-with-lease`: it verifies the remote-tracking tip actually appears in your local branch's reflog, i.e. you genuinely integrated it before rewriting. It is a no-op without `--force-with-lease`, and has no effect with the `--force-with-lease=<ref>:<sha>` form, which already pins an exact SHA.
|
||||
|
||||
Safest combination: `git push --force-with-lease --force-if-includes origin`.
|
||||
Safest combination: `rtk git push --force-with-lease --force-if-includes origin`.
|
||||
|
||||
## Server-side policy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user