1

Hi i would like to search for a file using a particular pattern in my GIT repo that has multiple projects .

Is it possible?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Balaji V
  • 918
  • 3
  • 10
  • 28

1 Answers1

1

A git repo doesn't know about the notion of "project".

You can simply grep in your current working tree (if those projects are checked out)

Or you can use git grep in order to search in the history of those same files, across branches.

See "How to grep (search) committed code in the git history?"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi Thanks .. One last thing . I am not looking at history here . I am looking for count of java files across projects in GIT . So i will grep "*.java" .. Will this still work – Balaji V Apr 01 '15 at 10:37
  • How do i grep a file pattern in Stash in an entire repository .. Without checking out the project i.e clone – Balaji V Apr 01 '15 at 11:15
  • @BalajiV you can also search online, but only with the hosting service allows it. For example, if your repo is hosted on GitHub, you can search for a string in java files. – VonC Apr 01 '15 at 11:24