我有以下两个强制存储库:
# compelte foo bar
mkdir complete-foo && cd complete-foo
git init
mkdir foo
echo bar > bar
echo bar > foo/bar
git add bar foo
git commit -a -m "complete foo bar"
cd ..
# deployed foo baz
mkdir deployed-foo && cd deployed-foo
git init
mkdir foo
echo baz > topbaz
echo bar > foo/baz
git add topbaz foo
git commit -a -m "deployed foo baz"
cd ..
以及跟踪它们的稀疏存储库:
mkdir sparse-bar && cd sparse-bar
git init
git config core.sparsecheckout true
echo foo >> .git/info/sparse-checkout
git remote add -f complete ../complete-foo
git fetch complete
git checkout -b complete complete/master
git remote add -f deployed ../deployed-foo
git fetch deployed
git checkout -b deployed complete/master
到目前为止,非常好。
现在我想只扩展/合并 foo / 文件夹中的文件,但它并没有像我预期的那样真正起作用。
E.g。如果我这样做,
echo boo >> foo/bar
git diff deployed..complete
我没有看到差异。
我还想了解如何仅将仅限于foo /及其子项的差异合并。我不想看到
之间的区别PS
花费数小时尝试“read-tree --prefix”方法来实现类似的功能。 Unsucceful。
答案 0 :(得分:0)
git commit foo/bar
git diff deployed..complete
..它的工作原理.. 8 - /
diff --git a/foo/bar b/foo/bar
index 6a2d84d..5716ca5 100644
--- a/foo/bar
+++ b/foo/bar
@@ -1,2 +1 @@
bar
-boo
和...
git checkout complete
git merge deployed