我可以将分支标记为“不推送"吗? [英] Can I mark a branch as 'not going to push'?

查看:86
本文介绍了我可以将分支标记为“不推送"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mercurial中使用命名分支.

I use named branches in Mercurial.

这样做,我创建了一个名为游乐场"的分支,在那里我可以尝试各种古怪的实验.我从不打算将此分支合并到其他分支,也不想将其推送到我们的主存储库.

In doing so I have created one branch called playground where I can try out various wacky experiments. I never intend to merge this branch into any others and I never want to push it to our main repository.

自创建以来,每次执行一次推送时,都会告诉我添加了一个新分支,并且必须使用--new-branch标志.此时,hg push -b default(或我要推送的任何分支)都可以正常工作,但是很烦人.是否可以通过让Hg知道我对推送该分支不感兴趣来抑制该消息?

Since creating it, every time I do a push I am told I have added a new branch and I have to use the --new-branch flag. At this point hg push -b default (or whatever branch I'm pushing) works fine but it's annoying. Is there any way to suppress that message by letting Hg know that I am not interested in pushing that branch ever?

推荐答案

从Mercurial 2.1(于2012年2月发布)开始,您可以将更改集标记为 secret ,以防止更改集被推送到另一个存储库.您使用新的 hg phase命令来执行此操作:

Starting with Mercurial 2.1 (released in February 2012), you can mark your changesets secret to keep them from being pushed to another repository. You use the new hg phase command to do this:

$ hg phase --force --secret .

这会将当前工作目录的父修订版(.)标记为处于secret阶段.秘密变更集在您的存储库中是本地的:它们不会被推送或拉出.现在推送看起来像这样:

This mark the current working directory parent revision (.) as being in the secret phase. Secret changesets are local to your repository: they wont be pushed or pulled. Pushing now looks like this:

$ hg push
pushing to /home/mg/tmp/repo
searching for changes
no changes to push but 2 secret changesets

在旧版本的Mercurial中没有等效的机制.最好的选择是为不想推送的变更集创建本地克隆.

There is no equivalent mechanism in older versions of Mercurial. There your best bet is to create a local clone for the changesets you don't want to push.

这篇关于我可以将分支标记为“不推送"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆