Skip to content

Commit e45ed9c

Browse files
committed
Adding a first claude slash command for syncing downstream with upstream
Signed-off-by: Matthias Wessendorf <[email protected]>
1 parent f675703 commit e45ed9c

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
description: Sync downstream repo with upstream main, preserving downstream-specific files
3+
---
4+
5+
Sync downstream repository with upstream changes while preserving downstream-specific files.
6+
7+
# Important Instructions
8+
9+
- **ALWAYS** start from a detached HEAD: `git checkout --detach`
10+
- **DO NOT** use TodoWrite tool
11+
- **DO NOT** ask for confirmations - just execute
12+
- **BE CONCISE** - minimal output, only show final summary
13+
14+
# Execution Steps
15+
16+
Execute these commands in sequence:
17+
18+
```bash
19+
# 1. Start from detached HEAD (REQUIRED)
20+
git checkout --detach
21+
22+
# 2. Delete old sync branch if it exists
23+
git branch -D sync-downstream 2>/dev/null || true
24+
25+
# 3. Fetch and create sync branch
26+
git fetch downstream
27+
git fetch upstream
28+
git checkout -b sync-downstream upstream/main
29+
git merge -s ours --no-commit downstream/main
30+
31+
# 4. Restore downstream files (read from .downstream-preserve or use defaults)
32+
git checkout downstream/main -- .ci-operator.yaml .snyk .tekton/ Dockerfile.ci Dockerfile.ocp Makefile-ocp.mk OWNERS mcp_config.toml renovate.json
33+
34+
# 5. Update dependencies
35+
go mod tidy
36+
go mod vendor
37+
git add vendor/
38+
39+
# 6. Commit everything in ONE commit
40+
git commit -am "sync: merge upstream main with downstream config"
41+
```
42+
43+
# Output
44+
45+
After completion, show ONLY:
46+
- Commit hash
47+
- File change summary: `git diff --stat downstream/main..HEAD | tail -1`
48+
- Next steps:
49+
```
50+
git push origin sync-downstream
51+
gh pr create --base downstream/main
52+
```
53+
54+
# Error Handling
55+
56+
If any command fails, stop immediately and show the error. No rollback needed - user can investigate.

.downstream-preserve

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Downstream files/folders to preserve during upstream sync
2+
# One entry per line, supports directories with trailing /
3+
.ci-operator.yaml
4+
.snyk
5+
.tekton/
6+
Dockerfile.ci
7+
Dockerfile.ocp
8+
Makefile-ocp.mk
9+
OWNERS
10+
mcp_config.toml
11+
renovate.json

0 commit comments

Comments
 (0)