有时我似乎无法跟踪合并冲突。我需要一个命令,允许我丢弃一个未提交的文件,然后使用远程副本对其进行更新。
我尝试了 hg revert myfile ,然后是 hg pull , hg commit 但它仍然不允许我合并或提交。
它一直告诉我先解决未解决的冲突。
您可能需要让 Mercurial 知道您已经解决了冲突,使用hg resolve
. 从手册页:
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>
使用它来覆盖本地文件并提交。