我有几百个远程和本地分支机构。我想知道是否有一个命令可以帮助我在所有分支中找到具有特定名称的文件夹。
我的 git 版本是 1.8.3.1。如果重要的话,我还安装了 smartgit。
提前致谢。
最佳答案
以下命令将输出所有指向提交的引用(本地和远程),该提交包含变量 SEARCH_PATH
SEARCH_PATH="somePath"
git for-each-ref --format="%(refname)" refs/heads refs/remotes |
while read ref
do
if [[ `git ls-tree -r --name-only $ref` =~ "$SEARCH_PATH" ]] ; then
echo $ref;
fi
done
关于linux - 在所有远程和本地 GIT 分支中查找特定文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31869385/