We have a repo with a bunch of projects. I am only concern with the "oracle" project within the repo. However, upon pulling down the codebase, I found subdirectories called "oracle" within other folders. Is there a way to only grab the parent folder that matches?
git init <repo>
cd <repo>
git remote add -f origin <url>
git config core.sparseCheckout true
echo "oracle/" >> .git/info/sparse-checkout
#ls -l
oracle
directory123
directoryabc
#find . | grep "oracle"
directory123/sub1/sub2/oracle
directoryabc/sub1/sub2/sub3/oracle
答案 0 :(得分:3)
通过将oracle/
写入$GIT_DIR/info/sparse-checkout
,您可以告诉您的Git仓库仅填充工作目录中的文件(如果有)其父目录被调用&#34;预言&#34; 。目录
oracle/
directory123/sub1/sub2/oracle/
directoryabc/sub1/sub2/sub3/oracle/
都满足这个条件。
如果要将sparse checkout限制在Git仓库的根目录的oracle
目录,则需要编写,而不是oracle/
,但是/oracle/
(注意前导斜线)到$GIT_DIR/info/sparse-checkout
。