gpt4 book ai didi

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

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

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

我试过 hg revert myfile 然后是 hg pull , hg commit
但它仍然不会让我合并或提交。

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

最佳答案

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

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/

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