mercurial - 如何告诉 Mercurial 1. 放弃本地文件 2. 使用远程文件

标签 mercurial conflict

有时我似乎无法跟踪 merge 冲突。 我需要一个命令,允许我丢弃一个未提交的文件,然后使用远程副本更新它。

我尝试了 hg revert myfile 然后 hg pull , hg commit 但它仍然不允许我 merge 或提交。

它一直告诉我先解决 Unresolved 冲突。

最佳答案

您可能需要让 Mercurial 知道您已使用 hgsolve 解决了冲突。从手册页:

hg resolve [OPTION]... [FILE]...

redo merges or set/view the merge status of files

  Merges with unresolved conflicts are often the result of non-interactive
  merging using the "internal:merge" configuration setting, or a command-
  line merge tool like "diff3". The resolve command is used to manage the
  files involved in a merge, after "hg merge" has been run, and before "hg
  commit" is run (i.e. the working directory must have two parents). See "hg
  help merge-tools" for information on configuring merge tools.

  The resolve command can be used in the following ways:

  - "hg resolve [--tool TOOL] FILE...": attempt to re-merge the specified
    files, discarding any previous merge attempts. Re-merging is not
    performed for files already marked as resolved. Use "--all/-a" to select
    all unresolved files. "--tool" can be used to specify the merge tool
    used for the given files. It overrides the HGMERGE environment variable
    and your configuration files.  Previous file contents are saved with a
    ".orig" suffix.
  - "hg resolve -m [FILE]": mark a file as having been resolved (e.g. after
  having manually fixed-up the files). The default is to mark all
  unresolved files.
  - "hg resolve -u [FILE]...": mark a file as unresolved. The default is to
    mark all resolved files.
  - "hg resolve -l": list files which had or still have conflicts. In the
    printed list, "U" = unresolved and "R" = resolved.

  Note that Mercurial will not let you commit files with unresolved merge
  conflicts. You must use "hg resolve -m ..." before you can commit after a
  conflicting merge.

以下是从服务器获取文件版本的方法。 当您“hg pull”时,来自服务器的所有更改都会进入您的存储库副本。您可以使用以下方法获取任何修订版本中的文件内容:

hg cat -r <rev> <file>

使用它覆盖本地文件,然后提交。

关于mercurial - 如何告诉 Mercurial 1. 放弃本地文件 2. 使用远程文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11633249/

相关文章:

mercurial - 如何查看 Tortoise HG 发出的 Mercurial 命令?

jquery - 如何让 jQuery 与 Prototype 一起工作

python - Mercurial安装centos 6.4 Python报错

grammar - 有没有办法消除这些减少/减少冲突?

c# - 发现同一依赖程序集的版本之间存在冲突

php - PHP并行/分布式工具和MySQL,以及如何跨多个服务器锁定功能

linux - OpenLDAP的libldap和Oracle的occi库之间的冲突

mercurial - 使用 hg 在两台计算机之间同步我的项目

mercurial - 是否可以在 Mercurial 中重新打开已关闭的分支?

bash - 使用 bash 更新带有日期行的日志文件