Search Git remote all branches for file contents

后端 未结 2 1202
無奈伤痛
無奈伤痛 2020-12-24 07:50

Is it possible to search all of my Git remote branches for specific file contents (not just a file, but contents within them)?

My remotes are on GitHub, in case that

2条回答
  •  甜味超标
    2020-12-24 08:32

    Assuming you are tracking all remote branches, this will search it in all commits:

    git log --all -p | grep 'search-string'
    

    To track all remote branches:

    for remote in `git branch -r`; do git branch --track $remote; done
    

提交回复
热议问题