Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检测两个git diff之间的合并冲突,而无需访问原始回购_Git - Fatal编程技术网

检测两个git diff之间的合并冲突,而无需访问原始回购

检测两个git diff之间的合并冲突,而无需访问原始回购,git,Git,是否可以在不访问存储库的情况下检测两个git diff之间的合并冲突 例如: $repo: git diff HEAD > ~/diff1 ... do work, move branches etc $repo: git diff HEAD > ~/diff2 $somewhereElse: git merge-diff ~/diff1 ~/diff2 I'm in a situation with a very large repo and every git operati

是否可以在不访问存储库的情况下检测两个git diff之间的合并冲突

例如:

$repo: git diff HEAD > ~/diff1
... do work, move branches etc
$repo: git diff HEAD > ~/diff2

$somewhereElse: git merge-diff ~/diff1 ~/diff2 
I'm in a situation with a very large repo and every git operation is too slow for what I need

Git has facilities for dealing with this: split indexes and minimum-checkout merges come to mind immediately.

Minimum-checkout merges aren't a separate facility, they're just how Git works: merge doesn't have to see anything but the files that might need automerge, i.e. were changed on both tips, so that's all the files that actually need to be in your work tree, and if you haven't set that up yet it'll do the checkouts for you, just the ones it needs.

If say you're on
dev
and want to merge
trunk
:

git clone -ns . `mktemp -d`; cd $_
git reset -q         # load just the index

# note that when I do the above on the full linux history, a 2.8GB repo on my box, 
# the clone and index reload, the result occupies about 6MB total Basically nothing.

git merge trunk
$repo:git diff HEAD>~/diff1
... 工作、移动树枝等
$repo:git diff HEAD>~/diff2
$somewhere:git merge diff~/diff1~/diff2

我正处于一个非常大的回购的情况下,每一个git操作对于我所需要的来说都太慢了

Git有处理这个问题的工具:并且可以立即想到最少的结帐合并

最小签出合并不是一个单独的功能,它们只是Git的工作方式:merge不需要看到任何东西,只需要看到可能需要自动合并的文件,即在两个提示上都发生了更改,因此这就是您的工作树中实际需要的所有文件,如果您尚未设置,它将为您进行签出,正是它需要的

如果说您在
dev
上并且想要合并
trunk

只有可能发生冲突的文件才会被签出

如果您的索引太大以至于任何更新都很痛苦,请在重置后执行
git update index--split index
,这将导致边带/基线文件中保留不变的条目,并且仅单独加载/重写更新的条目

如果你在推送结果后,你需要与你的主要回购协议协商
更新,最简单的可能是
git推送原始头:refs/heads/somenewbranch
然后快进你的主要回购协议。在执行git update index--split index之后,首先是natch

编辑:如果要运行到任何其他分支的测试合并,请将
-b thatbranch
添加到克隆。所有分支都是短暂的和本地的,您可以
git branch wip somecommit
和clone-nsb wip来重新点燃合并到该提交


我正处于一个非常大的回购的情况下,每一个git操作对于我所需要的来说都太慢了

Git有处理这个问题的工具:并且可以立即想到最少的结帐合并

最小签出合并不是一个单独的功能,它们只是Git的工作方式:merge不需要看到任何东西,只需要看到可能需要自动合并的文件,即在两个提示上都发生了更改,因此这就是您的工作树中实际需要的所有文件,如果您尚未设置,它将为您进行签出,正是它需要的

如果说您在
dev
上并且想要合并
trunk

只有可能发生冲突的文件才会被签出

如果您的索引太大以至于任何更新都很痛苦,请在重置后执行
git update index--split index
,这将导致边带/基线文件中保留不变的条目,并且仅单独加载/重写更新的条目

如果你在推送结果后,你需要与你的主要回购协议协商
更新,最简单的可能是
git推送原始头:refs/heads/somenewbranch
然后快进你的主要回购协议。在执行git update index--split index之后,首先是natch


编辑:如果要运行到任何其他分支的测试合并,请将
-b thatbranch
添加到克隆。所有分支都是短暂的和本地的,您可以
git branch wip somecommit
和clone-nsb wip以重新点燃合并到该提交。

您克隆了repo吗?如果您克隆了它,您可以尝试进行合并。如果没有,请检查diff是否修改了同一文件的同一部分。我现在的情况是有一个非常大的repo,而且每个git操作都太慢,无法满足我的需要,因此我不能只是隐藏、签出、应用等。我认为diff包含了理解它们是否会冲突所需的所有信息,但是我不知道有哪个命令可以根据我的需要对它们进行分析。如果没有回购协议就说
git diff
,那是毫无意义的。你会跟谁说话?嗯,还不完全清楚,但是你可以使用一个diff解析器,然后尝试找出补丁中修改的文件/行是否存在交叉点。你克隆了repo吗?如果你克隆了它,你可以尝试进行合并。如果没有,请检查diff是否修改了同一文件的同一部分。我现在的情况是有一个非常大的repo,而且每个git操作都太慢,无法满足我的需要,因此我不能只是隐藏、签出、应用等。我认为diff包含了理解它们是否会冲突所需的所有信息,但是我不知道有哪个命令可以根据我的需要对它们进行分析。如果没有回购协议就说
git diff
,那是毫无意义的。你会对谁说话?嗯,还不完全清楚,但你可以使用一个diff解析器,然后尝试找出补丁中修改的文件/行是否存在交叉点。但是你如何将这与OP的“不再访问存储库”相一致呢?@matt OP声称无法访问回购协议的原因是GIt使操作过于缓慢。我正在展示如何纠正导致他面临问题的限制。最好不要让问题成为问题,对吧?但你如何将其与OP的“不再拥有对存储库的访问权限”进行比较?@matt OP声明的无法访问回购协议的原因是GIt使得操作太慢。我正在展示如何纠正导致他面临问题的限制。最好让问题不成问题,对吗?