git mergetool --follow?

4
有没有一个标志可以在git-mergetool中像git-log--follow一样运行?
   --follow
       Continue listing the history of a file beyond renames (works only
       for a single file).

基本上,我希望它在合并重命名的文件时,而不是认为它们被删除。

git-mergetool提供以下功能:
       When git mergetool is invoked with this tool (either through the -t
       or --tool option or the merge.tool configuration variable) the
       configured command line will be invoked with $BASE set to the name
       of a temporary file containing the common base for the merge, if
       available; $LOCAL set to the name of a temporary file containing
       the contents of the file on the current branch; $REMOTE set to the
       name of a temporary file containing the contents of the file to be
       merged, and $MERGED set to the name of the file to which the merge
       tool should write the result of the merge resolution.

在文件被重命名/移动的情况下,我希望BASE/LOCAL/REMOTE仍然能够正常工作。我希望git-mergetool可以“跟随”将BASE重命名为LOCAL或REMOTE,具体取决于情况。


请勿编辑问题以完全更改其内容,而应提出新的问题。我已将其回滚到完全更改之前的版本。 - qqx
1个回答

1

git mergetool本身不执行合并,只是帮助清理由于已经在进行中的合并而产生的冲突。因此,对于mergetool命令应用该选项是没有意义的。

同样,在git merge中使用该选项也没有意义。合并将始终考虑文件移动。 --follow选项仅需要用于git log命令以覆盖不同的行为。正如您引用的那一部分所示,该选项仅适用于获取单个文件的日志,这种情况下您已经表明您只对该特定文件感兴趣。 --follow选项可用于指示您还想了解该文件的先前名称的信息。


“mergetool” 不是会收集基础文件、本地文件和远程文件吗?在这种情况下,我想要它实际上收集这三个文件,而不是在本地移动时说远程文件已被删除。 - Jayen
不,merge会将不同的版本合并到索引中。 - qqx
我已经编辑了问题,更清楚地表达了我的意思。这与不同版本是如何存储完全无关,只是它们存在的事实。 - Jayen
这仍然不改变merge已经遵循重命名的事实,因此对于mergemergetool命令,--follow选项没有用处。 - qqx
好的,好的,我想我更清楚这里发生了什么。重命名并不总是被正确地检测到,所以我想要一种告诉mergemergetool哪个本地匹配哪个远程的方法。 - Jayen

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接