I’ll sometimes edit directly on GitHub. It’s probably a package I’m using and I need to remove or add a line or two. For example, the prompt for this posting was to remove a line that added a log file globally using loguru
. It seemed a good idea at the time, when the file was only run in a self-contained way…but now it had been integrated into a larger framework, dumping a log file somewhat haphazardly depending on where I was running the application from. I just needed to remove that line.
Typically, when navigating to a file on github, it’s relatively straightforward to edit it. On the top right, just click the pencil icon.

Going to https://github.com/my_org/my_project
, I used the search function to find the offending line and opened that file. However, the pencil icon was disabled. I am left with a single option:

Here, a pleasant Visual Studio Code interface opens up. I quickly make my edit, but am told that I’m not on a branch: “Unable to commit your changes because you are not currently on a branch.”

After some circling around, I realized that the search function does not point to the default branch, but the most recent commit. This would have been obvious had I the patience to read the helpful message above the disabled pencil icon:

Selecting the dropdown for Switching branches/tags, I can select my main branch, and now the edit button appears!

VoilĂ ! I can edit the file.
