Loading...
Loading...
Use when syncing all git repos under ~/code across machines, typically at end-of-day (push) or start-of-day (pull). Triggers on「同步代码」「code-sync」「下班同步」「上班更新」.
npx skill4agent add niracler/skill code-sync~/code| Tool | Type | Required | Install |
|---|---|---|---|
| git | cli | Yes | |
| git-workflow | skill | No | Included in |
Do NOT proactively verify these tools on skill load. If a command fails due to a missing tool, directly guide the user through installation and configuration step by step.
| User says | Mode |
|---|---|
| 「下班同步」or "push" | Push |
| 「上班更新」or "pull" | Pull |
| 「同步代码」「code-sync」 | Ask user |
bash scripts/scan.sh # Push: local data only
bash scripts/scan.sh --fetch # Pull: fetch remote first (10s timeout/repo)pathnamebranchremoteremote_urldirty_counthas_upstreamaheadbehindfetch_error--fetch| Category | Condition | Action |
|---|---|---|
| up-to-date | | Report |
| needs-push | | Auto |
| dirty | | Interactive |
| no-upstream | | Ask user |
| Category | Condition | Action |
|---|---|---|
| up-to-date | | Report |
| needs-pull | | Auto |
| dirty+behind | | Interactive |
| fetch-error | | Report, skip |
| Situation | Steps |
|---|---|
| Dirty repo (push) | |
| No upstream (push) | Report → ask: set upstream and push ( |
| ff-only fails (pull) | |
| Dirty + behind (pull) | Report both issues → ask: stash and pull (stash, pull --ff-only, pop), or skip |
## {Push|Pull} Summary
{Pushed|Updated} (N):
- repo-name (branch, N commits)
Already up-to-date (N):
- repo-a, repo-b, ...
Resolved (N):
- repo-c: action taken
Skipped (N):
- repo-d: reason| Issue | Fix |
|---|---|
| Check |
| Check network, SSH keys |
| ff-only fails | Rebase or merge manually |
| Push rejected | Pull first, then push |