0

我有以下两个完整的存储库:

# 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/文件夹中的文件,但它并没有像我预期的那样工作。

例如,如果我这样做,

echo boo >> foo/bar
git diff deployed..complete

我看不出有什么区别。

我还想了解如何仅合并仅限于 foo/ 及其子项的差异。我不想看到两者之间的区别

附言

花几个小时尝试“read-tree --prefix”方法来实现类似的东西。不成功。

4

1 回答 1

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
于 2013-08-29T18:36:43.387 回答