sync-upstreamlisted
Install: claude install-skill rezathepure/claude-code-scenes
This repo was **cloned** from `claude-code-best/claude-code`, not forked, so GitHub
offers no sync button and nothing tracks the drift. Full history was preserved, so
`git merge-base` finds a real shared commit rather than an approximation — everything
below relies on that.
Work through the phases in order. Report findings before acting; stop and hand over
rather than guessing.
## 1. Refuse on a dirty tree
```bash
git status --porcelain
```
Must be empty. A merge into uncommitted work is how people lose work — say so and stop.
Offer to commit or stash, but do not do it unasked.
## 2. Fetch
The `upstream` remote should already exist. Add it if it does not:
```bash
git remote get-url upstream 2>/dev/null || git remote add upstream git@github.com:claude-code-best/claude-code.git
git fetch upstream
```
## 3. Survey before touching anything
```bash
BASE=$(git merge-base HEAD upstream/main)
git rev-list --left-right --count HEAD...upstream/main # ours <TAB> theirs
git log --oneline --no-merges "$BASE"..upstream/main
```
If they are 0 ahead, say "already up to date" and stop. Do not create an empty merge.
Then compute the number that actually predicts how the merge will go — **the overlap**:
```bash
git diff --name-only "$BASE"..HEAD | sort > /tmp/sync-ours.txt
git diff --name-only "$BASE"..upstream/main | sort > /tmp/sync-theirs.txt
comm -12 /tmp/sync-ours.txt /tmp/sync-theirs.txt
```
Files neither side shares cannot conflict, so this list is the whole