使用汞变基的汞线性历史记录,且未提交更改 [英] Mercurial linear history using hg rebase with uncommited changes

查看:125
本文介绍了使用汞变基的汞线性历史记录,且未提交更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在本地存储库中有几次提交,并且在工作目录中有一些未提交的更改. 在hg pullhg update之后,我从中央存储中获得了几个新的变更集,这些变更集在本地存储中创建了一个新的头.

Suppose I have several commits in local repo, and some uncommited changes in working dir. After hg pull, hg update, I get a couple of new changesets from central repo which create a new head in local repo.

现在假设,我不想合并这两个头并按下,在这种情况下,当我尝试合并时,我会收到一条消息,表示我在工作目录中有未提交的更改.

Now suppose, I don't want to merge those two heads and push, in which case I'll get the message that I have uncommited changes in working dir, when trying to merge.

同样,假设我不想使用hg shelve来搁置未提交的更改并合并而不会出现问题,但是想通过使用hg rebase创建线性历史记录,因此我将提交放在拉提交.重新设定基准后,实际上我会进行合并,如此处所示,位于章节.

As well, suppose I don't want to use hg shelve in order to shelve uncommited changes and merge without problems, but would like to create a linear history by using hg rebase, so I put my commits on top of pulled commits. When I do rebase, effectively I do a merge, as presented here, under hg rebase chapter.

现在我的问题是,我会得到相同的错误消息:不能合并,有未提交的更改",因为hg rebase是否进行隐式合并?

Now my question is, will I get the same error message: "can't do merge, there are uncommited changes", since hg rebase does implicit merge, or not?

如果是,那么我将在两种情况下都必须使用hg shelve:两个标头的显式合并和重新设置基准时的隐式合并,不是吗?

If yes, then I will have to use hg shelve in both cases: explicit merge of two heads and implicit merge when rebasing, no?

在此先感谢,
干杯

Thanks in advance,
Cheers

推荐答案

假设我在本地存储库中有几次提交,并且在工作目录中有一些未提交的更改.在进行hg pull,hg更新之后,我从中央存储库中获得了两个新的变更集,它们在本地存储库中创建了一个新的头.

Suppose I have several commits in local repo, and some uncommited changes in working dir. After hg pull, hg update, I get a couple of new changesets from central repo which create a new head in local repo.

如果您在工作目录中有未提交的更改,并且hg pull从上游为您提供了一个新的头,则hg update会告诉您:

If you have uncommitted changes in the working dir, and hg pull gives you a new head from upstream, hg update will tell you:

abort: crosses branches (merge branches or use --clean to discard changes)

如果您尝试合并,则会收到一条消息,提示您无法合并未提交的更改.

If you try to merge, you will then get a message about not being able to merge with uncommitted changes.

所有这些都是有很好的理由的:如果未提交更改,则在合并机制启动后,这些更改将永远丢失.您应提交或搁置未提交的更改,然后再尝试与之合并或重新建立基础上游代码.

All this is for very good reason: if changes aren't committed, they are subject to being lost forever when the merge machinery kicks in. You should either commit or shelve your uncommitted changes before trying to merge with or rebase onto the upstream code.

您可能还会考虑使用MQ来帮助您; MQ和rebase旨在共同发挥作用,因此,如果您的本地未完成更改由MQ管理,那么您要做的就是hg qrefresh; hg pull --rebase.

You might also look into using MQ to help you with this; MQ and rebase are designed to play well together, so if your local not-quite-finished changes are managed by MQ, all you have to do is hg qrefresh; hg pull --rebase.

这篇关于使用汞变基的汞线性历史记录,且未提交更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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