hyd*_*yde 22 mercurial push pull
我为新项目创建了本地hg存储库:hg init ; hg addremove然后我创建了空的上游repo,并在那里推送了第一个版本:hg push https://remoterepo.
现在,我想将其设置https://remoterepo为默认上游,所以我可以在不给它的情况下执行hg push/pull.
我很惊讶谷歌没有给我一个直接回答"设置mercurial upstream",我也没有在SO找到直接答案.因此,为了所有使用SO作为howto的人的利益,这样做的正确方法是什么?
K Z*_*K Z 27
你可以通过添加上游URL来做到/project/.hg/hgrc这一点:
[paths]
default = ssh://test@bitbucket.com/repos/something
upstream = ssh://test@bitbucket.com/repos/something_else
Run Code Online (Sandbox Code Playgroud)
现在upstream是repo的别名,something_else然后您可以从中拉出或推送到:
hg pull upstream
hg push upstream
Run Code Online (Sandbox Code Playgroud)
URL可以全部存储在配置文件中,路径别名位于[paths]部分下,如下所示:
Run Code Online (Sandbox Code Playgroud)[paths] alias1 = URL1 alias2 = URL2 ...然后,您可以对使用URL的任何命令使用别名(例如,
hg pull alias1将其视为hg pull URL1).两个路径别名是特殊的,因为当您不为命令提供URL时,它们将用作默认值:
- 默认
- 默认情况下,推