1

我正在尝试使用两个独立的分支。第一个分支更接近部署阶段,而第二个分支是早期开发阶段。由于某种原因,第二个分支不包含第一个分支的一些开发。当我在第二个分支上工作时尝试签出第一个分支时,我收到以下错误:

abort: crossed branches (use 'hg merge' to merge or use 'hg update -c' to discard changes)

现在我的问题是我不想摆脱第二个分支或无论如何都要编辑它。我什么时候可以选择,我是否错过了 Mercurial 的一些基本事实?

4

1 回答 1

1

You need to either commit your changes or otherwise save them (e.g. with hg shelve) before checking out a new branch.

Mercurial (and most CVSes AFAIK) doesn't save the state of the working directory until you commit the changes, so switching branches effectively discards anything you haven't commited. You can work around this with the hg shelve extension, or by having one working copy for each branch you're working on.

于 2012-07-16T13:32:26.427 回答