Install
$ agentstack add skill-nicholyx-ai-skills-git-sync-upstream ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Git Sync Upstream
将当前分支 rebase 到 upstream/main 的最新代码,适用于 fork 仓库同步上游更新的场景。
前置检查
执行任何操作前,先检查:
# 1. 确认 remote 配置
git remote -v
# 2. 确认当前分支
git branch --show-current
# 3. 检查是否有 upstream remote
git remote | grep -q upstream || echo "需要先添加 upstream remote"
如果用户没有配置 upstream remote,询问用户上游仓库地址。
工作流程
Step 1: 获取上游最新代码
git fetch upstream
Step 2: 查看更新情况
# 你的提交
git log upstream/main..HEAD --oneline
# 上游更新
git log HEAD..upstream/main --oneline
快速退出判断:
- 如果上游没有新提交(
HEAD..upstream/main为空),直接告知用户:
> ✅ 当前分支已是最新,无需同步。上游没有新的更新。
然后询问用户是否需要处理当前工作区的更改(如果有),直接结束流程。
- 如果上游有更新,继续执行后续步骤。
Step 3: 处理未提交的更改
检查是否有未提交的更改:
git status
如果有未提交的更改,询问用户选择:
- Stash 后 rebase(推荐)- 暂存更改,rebase 完成后恢复
- 先提交再 rebase - 提交这些更改后 rebase
- 放弃更改 - 丢弃这些更改
Step 4: 执行 Rebase
# 如果用户选择 stash
git stash push -m "temporary stash before rebase"
# 执行 rebase
git rebase upstream/main
如果 rebase 过程中发生冲突:
- 列出冲突文件
- 指导用户解决冲突
- 解决后执行
git rebase --continue
Step 5: 恢复暂存的更改
如果之前 stash 了更改:
git stash pop
Step 6: 推送更新
Rebase 成功后,需要强制推送(因为改写了历史):
# 先展示 rebase 后的 commit 历史
git log --oneline -5
# 询问用户确认后强制推送
git push origin --force
重要:强制推送是改写历史的操作,必须先向用户确认。
完成提示
操作完成后告知用户:
- ✅ Rebase 成功
- ✅ PR 已自动更新(GitHub PR 会自动反映推送的新 commits)
- 如果有 stash 的文件,说明当前状态(已暂存/未暂存)
常见问题
没有配置 upstream remote
git remote add upstream
Rebase 冲突
- 查看冲突文件:
git status - 手动解决冲突
- 标记为已解决:
git add - 继续 rebase:
git rebase --continue - 如果想放弃:
git rebase --abort
推送被拒绝
如果 force push 失败,可能是远程有新提交。先 pull 再 rebase:
git pull origin --rebase
git push origin --force
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: nicholyx
- Source: nicholyx/ai-skills
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.