Is it possible to search for a particular filename on GitHub?

痞子三分冷 提交于 2019-12-03 00:56:43

问题


I know that the GitHub web interface lets you search all repositories for files with a particular pathname (e.g. searching for path:/app/models/user.rb yields >109k results), but is there a way to search all repositories for filenames independent of their subdirectory location? I tried using asterisks in the path argument, and that didn't seem to work.


回答1:


Does the search user.rb in:path do what you want to do? Alternatively there is also this search filename:user.rb

Found on: https://help.github.com/articles/searching-code/




回答2:


In search input, you can use filename parameter to search in multiple repositories, for example:

filename:my_filename.txt

If you're looking for a filename in specific repository, you can just press t and start typing the file name (see: GH keyboard shortcuts).




回答3:


GitHub introduced FileFinder in 2011.

Try it out: just hit t on any repo's file or directory view.[1]

So, You're still restricted to repository.

[1]https://github.com/blog/793-introducing-the-file-finder

Another approach to Your question:

Can I use Git to search for matching filenames in a repository?




回答4:


In my case, I wanted to search for a particular file name, in all of my organization's repositories. This can be done by entering this in the search box:

org:your-organization-user-name filename:the-file-name

Of course, just do "filename:the-file-name" if you want to search the whole of GitHub.

I didn't see this in https://help.github.com/articles/searching-code/ but found out when I switched context, and GitHub entered the filter for me automaticallly.




回答5:


You can try Google. Google for filename.txt site:github.com.




回答6:


I refined @andy-lester answer with intitle:, i.e. I want to find where's located the file simple_spinner_item.xml in Android's source code hosted on github, so I search on Google this string:

site:github.com intitle:simple_spinner_item.xml github.com/android

^                       ^                       ^
|                       |                       |
on github site          |                       |
                        |                       |
filename I'm searching -+                       |
                                                |
github user ------------------------------------+



回答7:


Just press "t" and It will let you search for a file.



来源:https://stackoverflow.com/questions/18991908/is-it-possible-to-search-for-a-particular-filename-on-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!