In yesterday’s tip, it was easy to find the desired Pull Request when there’s only been one Pull Request created. Today, let’s say that you want to restore a deleted branch, but you need to search for the Pull Request to get to the Restore button. Deleted branches aren’t shown on the Branches page.
Navigate to the Pull Request tab, and in the search field, 1. delete the search defaults and 2. type in
Notice you’re using head: as the search parameter because there are two branches involved in a Pull Request. The base branch is the branch that the changes are going into. The head branch is the source of those changes.
And in the above screenshot, you see the Updated the readme PR that contains the readme-draft.
You can also search based on base branch using the base:<branch-name> search option. Check out the search documentation for more information.
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.
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.
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”.
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