Mercurial:有什么方法可以“合并并放弃更改”吗?
我有一个看起来像这样的图形日志:
(snip)
| |
| o 1) Other Dev: Commit
| | \
o | | 2) Me: Commit
/ | | |
| | o | 3) Other Dev: Commits with an error
| |/| |
| o |/ 4) Me: Merge and commit
| /|
|/ |
o | 5) Me: Realize there were bugs in the commit and take earlier version to merge with
| o 6) Other Dev: Fixes error
o / 7) Me: committing some changes
|/
o 8) Me: Merge fixed tip
在 (8) 处,除了 (4) 处悬空的额外头部之外,一切都应该如此。为了摆脱它,我必须合并 (4) -.-> (8) 但是,由于 (4) 中没有我需要的内容,所以我可以安全地放弃它的所有更改。我可以逐个文件手动进行合并(通常这没什么大不了的),但为了我自己的启发 - 有没有一种简单的单行方法来表示“将 (4) 与 (8) 合并并且始终采取(8)”?
I have a graphlog that looks something like this:
(snip)
| |
| o 1) Other Dev: Commit
| | \
o | | 2) Me: Commit
/ | | |
| | o | 3) Other Dev: Commits with an error
| |/| |
| o |/ 4) Me: Merge and commit
| /|
|/ |
o | 5) Me: Realize there were bugs in the commit and take earlier version to merge with
| o 6) Other Dev: Fixes error
o / 7) Me: committing some changes
|/
o 8) Me: Merge fixed tip
At (8), everything is as it should be with the exception of the dangling extra head at (4). To get rid of it I have to merge (4) -.-> (8) but, since there is nothing in (4) that I need, I can safely discard all of it's changes. I could do this merge manually file-by-file (and usually this isn't that big a deal) but for my own edification - is there a simple one-line way to say "merge (4) with (8) and always take (8)"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。
internal:local
内置合并工具。类似地,还有
internal:other
选择文件的其他版本作为合并版本。下面是一个说明发生了什么的示例,从具有单个文件的存储库开始:
对其进行分支并将冲突放入
a
中:同时在合并的分支中添加另一个文件:
返回并合并匿名头:
当然,此时如果没有合并工具,我们就会在
a
上遇到冲突。但是使用合并工具,我们告诉 Mercurial 在与 cset 合并也触及的每个文件上采用第一个父级的版本。Yes. The
internal:local
builtin merge tool.Similarly there's
internal:other
that picks the other version of files as the merged version.Here's an example to clarify what's going on, start off with a repo with a single file:
Branch it and put a conflict in
a
:Also add another file just in the merged in branch:
Go back and merge the anonymous head:
Naturally at this point without the merge tool we'd get a conflict on
a
. But using the merge tool, we're telling Mercurial to take the version of the first parent on every file that the merged with cset has also touched.