git-sync-main

Installation
SKILL.md

Git Sync Main

同步最新主分支代码到本地并切换到主分支。支持两种场景:fork 的项目从 official remote 同步,自己的项目从 origin 同步。

触发条件

当用户要求同步上游代码、更新主分支、或拉取最新主分支代码时使用此 skill。

执行步骤

  1. 检查 remote 配置git remote -v,确认是否存在 official remote。

  2. 根据是否存在 official remote 分两种情况执行

情况一:存在 official remote(fork 的项目)

  1. 检测主分支名称:通过 git remote show official 或查看本地分支,确定主分支名称(mainmaster)。

  2. 拉取 official 最新代码git fetch official

Related skills
Installs
150
First Seen
Apr 27, 2026