Mercurial中切换分支时如何防止文件自动合并?

发布于 2024-09-13 09:29:13 字数 725 浏览 2 评论 0原文

假设我有两个名为 defaultnewfeature 的分支。我在两个分支中都有一个名为 readme.txt 的文件。我正在开发 newfeature 分支,并对 readme.txt 进行了更改。如果我运行 hg up default 而不提交更改,Mercurial 会自动将 newfeature 中的 readme.txt 版本直接合并到 default 中。

我怎样才能改变这种行为?我担心的是开发人员在切换分支之前忘记提交,从而合并他们正在处理的任何内容。

该过程如下所示:

C:\source\BranchTest\Main>hg branch
Exams

C:\source\BranchTest\Main>hg status
M readme.txt

C:\source\BranchTest\Main>hg up default
merging readme.txt
0 files updated, 1 files merged, 0 files removed, 0 files unresolved

C:\source\BranchTest\Main>

请注意自动合并,因为我没有将更改提交到 readme.txt。 Mercurial 没有警告我这会发生。

有什么建议吗?

Let's say I have two branches named default and newfeature. I have a file called readme.txt in both branches. I'm working on the newfeature branch and I make a change to readme.txt. If I run hg up default without committing the change, Mercurial automatically merges the version of readme.txt in newfeature directly into default.

How can I change this behavior? What I'm worried about is developers forgetting to commit before they switch branches, thus merging whatever they've been working on.

This is what the process looks like:

C:\source\BranchTest\Main>hg branch
Exams

C:\source\BranchTest\Main>hg status
M readme.txt

C:\source\BranchTest\Main>hg up default
merging readme.txt
0 files updated, 1 files merged, 0 files removed, 0 files unresolved

C:\source\BranchTest\Main>

Notice the automatic merge because I didn't commit the change to readme.txt. Mercurial doesn't warn me that this will happen.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红焚 2024-09-20 09:29:13

使用hg up -c(小写“c”)。这将在更新之前检查您的工作目录。

您可以在 hgrc 文件中将其设置为默认值。

Use hg up -c (lower-case 'c'). This will check your working directory before updating.

You can make this the default in your hgrc file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文