Suppose you have a file that you want to delete*, but don’t want to break out a command line interface to do so. You can delete the file directly from GitHub.com.
Next you can commit the changes to delete the file to the commit.
*Note that this Delete this file button only removes the file from this commit on this particular branch moving forward. It won’t delete the file in any previous commit history or other branches (until they are merged and only from this commit moving forward).
If you need to permanently delete a file (or even if don’t, you still need to read this doc if you haven’t already), check out GitHub’s documentation on Removing Sensitive Data.
Why no -r delete option (read: why no recursive delete)? The shortest answer is this is how Git works as a Distributed Version Control System. If one or more people have cloned your repo, and if anyone changes their Git repo history, the repos won’t be compatible anymore (there might still be a way but it’s way beyond my skills as of today). And note how I’m saying this is how Git works (instead of “how GitHub works”). This is Git functionality. If you want to read more for possible options, check out the git-scm documentation on rewriting history.
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
Suppose you notice a typo in your repo description or you didn’t specify one at the time you created the repo. To the far right, you’ll see an edit button.
Clicking this button allows you to edit a description and a website URL.
Give it a little while, but your repo description will end up on the GitHub.com search page when you do.
I’m sitting here wondering, “is this a useful tip?” but then I remember that feeling I felt when I (finally) found how to do it. Originally I thought I had to update a repo file somewhere, since it took me a while to get used to what files GitHub’s UI gets it’s info from (e.g. license) and what files are metatdata for the GitHub repo itself.
Not only does the color bar show you a breakdown of language usage percentages, these labels are clickable!
In my random-example repo, if you click on the VB 16.5% (or whatever it might be by the time you read this), you’ll see
Now you can filter all files in repo based on language without needing text in the search bar.