【问题标题】:How to pull in upstream changes into a fork using Mercurial?如何使用 Mercurial 将上游更改引入分支?
【发布时间】:2010-04-21 00:31:48
【问题描述】:

我已经 fork 了一个 Mercurial 存储库,现在我想将更改从主存储库拉到我的 fork 中。如果这是 git,我会做类似...

git remote add upstream <url>
git pull upstream master

我如何在 Mercurial 中做这种事情?

【问题讨论】:

    标签: mercurial


    【解决方案1】:

    你也可以在你的 repo 中修改你的 hgrc 文件

    default = ssh://hg@bitbucket.org/<my_user>/<my_repo>
    upstream = ssh://hg@bitbucket.org/<other_user>/<other_repo>
    

    那你就可以了

    hg pull upstream
    

    【讨论】:

      【解决方案2】:

      如果您从要从中提取更改的存储库中克隆了存储库,您只需执行以下操作:

      hg pull
      

      如果您从另一个存储库克隆了该存储库,您可以:

      hg pull <location of repository to pull from>
      

      然后您需要更新您的工作副本:

      hg update
      

      无论如何,这就是基础。更多详细信息,请访问Mercurial: The Definitive Guide

      【讨论】:

        【解决方案3】:

        你试过拉命令吗?

        hg pull http://master.com/master
        

        如果这不起作用,请详细说明。

        【讨论】:

          【解决方案4】:

          您还可以修改您的 repo 中的 hgrc 文件以使用特殊路径名 default 和 default-push。

          default-push = ssh://hg@bitbucket.org/<my_user>/<my_repo>
          default = ssh://hg@bitbucket.org/<other_user>/<other_repo>
          

          然后你可以从上游(又名默认)拉

          hg pull
          

          并使用

          推送到分叉(又名默认推送)
          hg push
          

          【讨论】:

          • 如果其他用户对&lt;my_repo&gt; 进行更改,这不会中断吗?这仅适用于单用户回购,对吗?
          猜你喜欢
          • 2019-03-29
          • 2015-05-20
          • 2014-10-15
          • 1970-01-01
          • 1970-01-01
          • 2012-04-06
          • 1970-01-01
          • 2011-05-23
          • 2011-08-11
          相关资源
          最近更新 更多