如何自动将分叉的Github源/主分支对齐/同步到上游/主站?

时间:2015-02-20 23:01:13

标签: git github version-control repository git-fork

有没有办法自动同步我的分叉 Github存储库的远程主分支(origin/master)到原始 Github存储库的主分支? (upstream/master

我问,因为我希望我在Github上的分叉远程 origin/master分支始终保持最新,这样我就可以节省时间而不需要不断地 / rebase & 上游存储库更改推送到我的fork repo主分支。

3 个答案:

答案 0 :(得分:7)

同步分叉存储库非常容易,但问题是如何?

在此示例中,我使用的是WorldMapGenerator Repository

  

转到您的分叉存储库,您可以看到设置按钮点击它。

enter image description here

  

点击设置按钮后,您可以看到Webhooks&左侧菜单中的服务选项单击它。

enter image description here

  

然后您可以在右侧看到添加Webhook按钮,只需单击它即可。

enter image description here

  

单击添加Webhook按钮后,详细信息页面将打开,因此详细页面中您可以看到 payload url 。在其中输入http://backstroke.us个网址。

enter image description here

现在,如果任何提交进入主存储库,则pull请求将进入您的分叉存储库。

它很享受:)

有关详细信息https://github.com/1egoman/backstroke

答案 1 :(得分:3)

GitHub没有这样的自动同步功能。但是,在服务器上添加作为cron作业是微不足道的,这样您就不必手动执行。例如:

cd /srv/mirrorrepo ; git fetch upstream master ; git push origin master

答案 2 :(得分:3)

更新@Keval Bhatt答案:

  

仰泳有两种版本:

     

Backstroke Classic,原始版本。它大约在一年前由我制作并且被弃用,但是其他人在网上发布了它。为了进行此设置,用户手动将https://backstroke.us添加为其存储库中的webhook。

     

仰泳,Backstroke的新版本。这有一个用户可以用来设置Backstroke的仪表板,不需要手动添加webhooks。 url https://backstroke.us/_5a4ds65f46464s65d4654是在幕后添加到您的存储库的webhook,但除非您想将Backstroke绑定到某个自定义系统,否则您永远不必自己调用它。如果您只想将更改从一个仓库同步到另一个仓库,那么您不必考虑webhook,因为它由系统管理。

https://github.com/1egoman/backstroke/issues/60#issuecomment-318923158

现在您只需要访问https://backstroke.us,登录并添加存储库之间的链接,并自动创建拉取请求:

  1. enter image description here
  2. enter image description here
  3. 在幕后,https://backstroke.us将设置GitHub webhooks以使用https://backstroke.us网站界面自动提取更新。