是否可以在不再访问存储库的情况下检测两个 git diff 之间的合并冲突?
例如:
$repo: git diff HEAD > ~/diff1
... do work, move branches etc
$repo: git diff HEAD > ~/diff2
$somewhereElse: git merge-diff ~/diff1 ~/diff2 ???? ??
编辑:
这是两个冲突的差异的示例,我们可以在不了解存储库的情况下分辨出来
diff --git a/schema.graphql b/schema.graphql
index 346rb8i42tg..3f0deee83ad 100644
--- a/schema.graphql
+++ b/schema.graphql
@@ -12,7 +12,6 @@ interface Thing {
interface Being {
name: String!
- possessions: [Thing!]!
lifeExpectancy: Float
friends: [Being!]!
optionalFriends: [Character]
diff --git a/schema.graphql b/schema.graphql
index 297fb5e764e..de9fbc233ac 100644
--- a/schema.graphql
+++ b/schema.graphql
@@ -14,6 +14,7 @@ interface Being {
name: String!
possessions: [Thing!]!
lifeExpectancy: Float
+ surname: String
friends: [Being!]!
optionalFriends: [Character]
isRebel: Boolean!
我的情况是有一个非常大的仓库,并且每个 git 操作对于我的需要来说都太慢了
Git 有处理这个问题的工具:分割索引 https://git-scm.com/docs/git-update-index#Documentation/git-update-index.txt---split-index立即想到的是最小结账合并。
最小检出合并不是一个单独的工具,它们只是 Git 的工作方式:合并不需要看到任何东西,除了要查看的文件。might需要自动合并,即在两个提示上都进行了更改,因此这就是您的工作树中实际需要的所有文件,如果您尚未设置它,它会为您进行检出,仅检查它需要的文件。
如果说你在dev
并想要合并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
并且只会检出可能发生冲突的文件。
如果您的索引太大以至于任何更新都很痛苦,请执行以下操作git update-index --split-index
重置后,这将导致未更改的条目保留在边带/基线文件中,并且仅单独加载/重写更新的条目。
如果你想要推动结果,你需要协商HEAD
更新你的主仓库,最简单的可能是git push origin HEAD:refs/heads/somenewbranch
然后将您的主要存储库快进到该位置。做完之后git update-index --split-index
他们的第一场比赛。
编辑:如果您想运行测试合并到任何其他分支,请添加-b thatbranch
到克隆人。所有分支都是临时的和本地的,您可以git branch wip somecommit
并克隆 -nsb wip 以重新飞行对该提交的合并。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)