gpt4 book ai didi

Mercurial 用于 merge 多个头

转载 作者:行者123 更新时间:2023-12-04 00:02:15 25 4
gpt4 key购买 nike

我是善变的新手,想学习如何使用我的 repository .你能告诉我如何将我 friend 的作品与我的作品 merge 吗?谢谢

$ hg update tip
abort: crosses branches (merge branches or use --clean to discard changes)

$ hg heads
changeset: 265:ac5d3c3a03ac
tag: tip
user: roberto.cr
date: Thu Oct 06 07:32:15 2011 +0000
summary: fixing "redirects" links

changeset: 261:6acd1aaef950
user: niklasro
date: Thu Oct 06 07:53:19 2011 +0000
summary: auth backend + js

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

我可以使用 hg resolve 吗?
$ hg resolve
abort: no files or directories specified; use --all to remerge all file

$ hg glog | more
@ changeset: 266:2bf5b62720fc
| tag: tip
| parent: 261:6acd1aaef950
| user: niklasro
| date: Thu Oct 06 12:48:20 2011 +0000
| summary: added
|
| o changeset: 265:ac5d3c3a03ac
| | user: roberto.cr
| | date: Thu Oct 06 07:32:15 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 264:2fd0bf24e90f
| | user: roberto.cr
| | date: Thu Oct 06 07:29:58 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 263:29a373aae81e
| | user: roberto.cr
| | date: Thu Oct 06 07:25:05 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 262:d75cd4d3e77a
| | parent: 260:dfb54b99f84d
| | user: roberto.cr
| | date: Thu Oct 06 07:24:55 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 261:6acd1aaef950
|/ user: niklasro
| date: Thu Oct 06 07:53:19 2011 +0000
| summary: auth backend + js
|
o changeset: 260:dfb54b99f84d
| user: niklasro
| date: Wed Oct 05 05:34:37 2011 +0000
| summary: FB buggfix example.html
|
o changeset: 259:92fb6b1bc492
| user: niklasro
| date: Thu Sep 29 16:42:33 2011 +0000
| summary: changes

解决方案是 hg revert -a现在看起来很成功
$ hg glog | more
@ changeset: 267:3b2bb6de33eb
|\ tag: tip
| | parent: 266:2bf5b62720fc
| | parent: 265:ac5d3c3a03ac
| | user: niklasro
| | date: Thu Oct 06 16:06:21 2011 +0000
| | summary: merge
| |
| o changeset: 266:2bf5b62720fc
| | parent: 261:6acd1aaef950
| | user: niklasro
| | date: Thu Oct 06 12:48:20 2011 +0000
| | summary: added
| |
o | changeset: 265:ac5d3c3a03ac
| | user: roberto.cr
| | date: Thu Oct 06 07:32:15 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 264:2fd0bf24e90f
| | user: roberto.cr
| | date: Thu Oct 06 07:29:58 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 263:29a373aae81e
| | user: roberto.cr
| | date: Thu Oct 06 07:25:05 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 262:d75cd4d3e77a
| | parent: 260:dfb54b99f84d
| | user: roberto.cr
| | date: Thu Oct 06 07:24:55 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 261:6acd1aaef950
|/ user: niklasro
| date: Thu Oct 06 07:53:19 2011 +0000
| summary: auth backend + js
|
o changeset: 260:dfb54b99f84d
| user: niklasro
| date: Wed Oct 05 05:34:37 2011 +0000
| summary: FB buggfix example.html
|
o changeset: 259:92fb6b1bc492
| user: niklasro
| date: Thu Sep 29 16:42:33 2011 +0000
| summary: changes

最佳答案

这里的基本问题是您的工作目录不干净。 Mercurial 可以防止人们在未提交更改的分支之间意外跳转,因为这通常是一个坏主意。

让我们从第一个命令开始:

$ hg update tip
abort: crosses branches (merge branches or use --clean to discard changes)

这告诉你两件重要的事情:
  • 你试图越过 Twig
  • 您有未提交的更改

  • 你有两个选择:
  • merge
  • 使用 hg update --clean 丢失更改

  • 那么你有哪些改变呢?第一步是运行'hg status'。正如您所说的“hg status 输出许多以 1 或 ? 开头的文件”。那么那些“1”实际上是“!”指示已删除/丢失的文件(获得更好的字体!)。您应该仔细检查摘要,这将为您提供如下输出:
    parent: 15200:fa6f93befffa 
    patch: use more precise pattern for diff header color styling (issue3034)
    branch: default
    commit: 1 deleted, 1 unknown (clean) <- your changes
    update: (current)

    如果您此时尝试 merge ,您将收到如下消息:
    $ hg merge stable
    abort: outstanding uncommitted changes (use 'hg status' to list changes)

    如果您有除丢失文件以外的更改,您需要考虑提交它们。

    如果这些丢失的文件是您唯一的更改,则丢弃它们可能是可以的:
    hg revert -a

    完成此操作后,您将处于 Mercurial 允许您更新或 merge 而无需提示的状态。

    最后,您说“hg status 从其他项目输出许多文件,因为它从 .. 我添加的文件是唯一应该添加的文件。”。这是对 Mercurial 工作原理的基本误解。与 CVS 或 SVN 不同, 只有一个项目就 Mercurial 而言,操作(提交/更新/merge/状态)一次对整个项目树起作用。子目录不是具有独立历史的独立项目。

    关于Mercurial 用于 merge 多个头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7671654/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com