linux - 在所有远程和本地 GIT 分支中查找特定文件夹

标签 linux git smartgit

我有几百个远程和本地分支机构。我想知道是否有一个命令可以帮助我在所有分支中找到具有特定名称的文件夹。

我的 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/

相关文章:

git - 我怎样才能摆脱 "Lost heads"?

linux - 为什么我无法登录用户 Santosh?

linux - 模块中 tasklist_lock 的替代方案?

git - 在 git rebase 期间,如何保留原始内容并丢弃更改?

git - Smartgit - 无法 pull 、推送和同步存储库和文件

windows - SmartGit:日志窗口非常慢

python - 使用Python挂载磁盘驱动器

linux - 在脚本中运行 perf-top

java - 将带有 JSON 数据的授权 curl -u post 请求转换为等效的 RestTemplate

git 子树 : possible to change subtree branch/path in a forked repository?