feat(skill): set repo-local pull.rebase policy
pulling-before-work 1.0.1 -> 1.1.0: step 1b ensures repo-local pull.rebase=true + pull.ff=only (set-if-absent) so manual pulls never create merge commits, matching snolla baseline. Skill's own pull stays --ff-only (aborts on divergence, never leaves repo mid-rebase).
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
---
|
||||
name: pulling-before-work
|
||||
author: ours
|
||||
version: 1.0.1
|
||||
version: 1.1.0
|
||||
description: >
|
||||
Pulls the current branch from origin once at session start and on explicit
|
||||
re-sync requests. Use when AGENTS.md contains the trigger line "pull remote
|
||||
before work", or when the user says "sync", "resync", "pull", "обнови репо",
|
||||
"git pull please", or close variants asking to refresh from the remote.
|
||||
Runs `git pull --ff-only` — never auto-merges or rebases. Stays silent in
|
||||
non-git folders. Prints one informational line and exits when there is no
|
||||
Runs `git pull --ff-only` — never auto-merges or rebases. Also sets the
|
||||
repo-local pull policy (`pull.rebase=true` + `pull.ff=only`, set-if-absent)
|
||||
so plain manual `git pull` never creates merge commits either. Stays silent
|
||||
in non-git folders. Prints one informational line and exits when there is no
|
||||
origin remote, no upstream tracking, the working tree is dirty, or HEAD is
|
||||
detached. Does not stash, commit, or push. Activated by `project-bootstrap`
|
||||
v1.4.0+ via the canonical AGENTS.md template.
|
||||
@@ -38,6 +40,15 @@ git rev-parse --is-inside-work-tree 2>/dev/null
|
||||
|
||||
If the command fails or prints anything other than `true` → **exit silently, no chat output.** This is the not-a-git-repo case; the skill must not be noisy in random folders.
|
||||
|
||||
### 1b. Ensure the repo's local pull policy (set-if-absent)
|
||||
|
||||
```bash
|
||||
git config --local --get pull.rebase >/dev/null 2>&1 || git config --local pull.rebase true
|
||||
git config --local --get pull.ff >/dev/null 2>&1 || git config --local pull.ff only
|
||||
```
|
||||
|
||||
Sets the repo-local pull policy to the snolla baseline: plain `git pull` rebases instead of creating a merge commit (`pull.rebase=true`), and the merge path refuses non-fast-forwards (`pull.ff=only`). **Set-if-absent only** — an explicit local override the user wrote is never clobbered. Silent: no chat output, idempotent, works in dirty trees. Git config is untracked, so this never dirties `git status`. The skill's own pull below still uses `--ff-only` on purpose: a silent session-start pull never leaves the repo mid-rebase; divergence is always resolved by the human.
|
||||
|
||||
### 2. Has an `origin` remote?
|
||||
|
||||
```bash
|
||||
@@ -104,7 +115,7 @@ Classify by exit code and stdout:
|
||||
|---|---|
|
||||
| Already up to date | `✅ already up to date with <upstream>` |
|
||||
| Fast-forward, N commits | `✅ pulled N commits from <upstream>` |
|
||||
| Non-fast-forward / diverged (exit non-zero with "diverged" or "non-fast-forward" in output) | `⚠️ diverged from <upstream> — resolve manually (git pull --rebase or merge); skill never auto-merges/rebases` |
|
||||
| Non-fast-forward / diverged (exit non-zero with "diverged" or "non-fast-forward" in output) | `⚠️ diverged from <upstream> — resolve manually (plain git pull rebases by default; git pull --no-ff for a merge commit); skill never auto-merges/rebases` |
|
||||
|
||||
### Out of scope
|
||||
|
||||
@@ -115,6 +126,7 @@ The skill never:
|
||||
- pulls from non-`origin` remotes
|
||||
- pulls on detached HEAD
|
||||
- runs auto-merge or auto-rebase
|
||||
- overwrites an existing local pull policy (set-if-absent only)
|
||||
- runs more than once per session unless the user asks
|
||||
|
||||
## Recovery hints
|
||||
@@ -138,10 +150,10 @@ git add . && git commit -m "wip"
|
||||
If the skill reported `diverged`:
|
||||
|
||||
```bash
|
||||
# Option A: rebase your local commits on top of origin
|
||||
git pull --rebase
|
||||
# Option A (repo default, set by step 1b): rebase your local commits on top of origin
|
||||
git pull
|
||||
|
||||
# Option B: explicit merge (creates a merge commit)
|
||||
# Option B: explicit merge commit
|
||||
git pull --no-ff
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user