Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to execute git-grep command on a remote repository tree?

I would like to search the contents of files located in one of subtrees of the remote repository (origin/master). git-grep documentation says that command works on a current working tree. Consequently, how can I search through files that make up remote repo tree?

like image 313
Marek Bocian Avatar asked Oct 15 '25 14:10

Marek Bocian


1 Answers

There is no way in git. Either you fetch the remote commits locally or use out-of-git access to the remote repository. With ssh you just do ssh remote-host "cd /repo && git grep". With web access use whatever search is provided.

like image 134
phd Avatar answered Oct 18 '25 02:10

phd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!