How to open a file by typing the file name directly from the GitHub repo page – 012

You may not have noticed before, but each GitHub repo page has a Find file button next to the Clone or download button. It’s amazing how many times I’ve clicked the clone button and never even noticed this Find file button.

Find file button on repo page

The File file button takes you to the File Finder page. For example, in the image below, you’re seeing the files from my UX Masters project TheoryC.

Listing of files in TheoryC repo

And from this screen, you can start typing the name of a file.

But why click a button when you can use a keyboard shortcut?!

GitHub has a great collection of keyboard shortcuts. I’m ramping up on these shortcuts myself, hence this blog series. Let’s start with finding files.

On a repo home page, for example https://github.com/saraford/TheoryC, you can press the letter t to navigate directly to this File Finder page.

Now type the name of the file or folder. e.g. I want to go to the MainViewModel class. So I can just start typing “main”.

File finder only showing files containing main as partial match

Notice how in the previous image all I had to type was “main” and the file finder found three files using partial matching. I didn’t have to specify which folder these files resided in. The search was exhaustive throughout the repo.

To recap, to search for a file via the keyboard, press the letter ‘t’ and then start typing the name of your file. No button clicks required Smile

Leave a comment