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

后端 未结 8 835
遇见更好的自我
遇见更好的自我 2021-01-30 01:27

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 >

相关标签:
8条回答
  • 2021-01-30 01:37

    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).

    0 讨论(0)
  • 2021-01-30 01:40

    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 ------------------------------------+
    
    0 讨论(0)
  • 2021-01-30 01:41

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

    0 讨论(0)
  • 2021-01-30 01:42

    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?

    0 讨论(0)
  • 2021-01-30 01:42

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

    0 讨论(0)
  • 2021-01-30 01:46

    I would like to clarify @ajain's answer.

    1. In Github Web UI, you have to already be in the Reop's directory view.


    1. Then, press the T key. A file finder appears.


    1. Enter a filename to open it.


    More shortcuts for source code browsing.

    0 讨论(0)
提交回复
热议问题