There are lots of ways to target a git commit and one way that I often forget to use (but really like it when I remember) is targeting a specific git commit by the commit message.
The checksum is like a fingerprint for the file. A file is processed through a known algorithm which results in the checksum, a.k.a “hash”, which is a string of letters and numbers unique to that file, e.g. 8ab686eafeb1f44702738c8b0f24f2567c36da6d. If the file is modified, the resulting checksum will be different. This allows a quick way to […]
On the Mac OS X bash command line, you can delete all directories, with the exception of one, in the following way. If our current directory has sub-directories and we want to delete all of them except, ./really-important-do-not-delete, we can run $ shopt -s extglob $ rm -rf !(really-important-do-not-delete) $ ls really-important-do-not-delete $ original source
Since I’m always forgetting the format for the command line “find” command, I’ve made a note of it here.
I’ve recently moved to using the terminal program alacritty, which does not natively do paging. This is not generally a problem since I can pipe results to less. $ ls dir-w-lots-of-files | less However, I found myself working in command line MySQL and I got LOTS of results but could not page back. It turns […]
There is a very useful command line tool called which. This tool determines which file will be executed when you type it. Unfortunately, this command can sometimes provide the wrong answer. Update: I’ve recently been introduced to the type command, which seems to do what I want. You can jump to the section on using […]
This tweet blew my mind. $ git log | vim -R –Now press <K> on a commit hash. — Luke Diamand (@LukeDiamand) February 21, 2018 I spend a lot of my time in Vim and Git and this is an amazing combination of the two. While I love this command, I think we can do […]
At a recent WordPress meetup we were discussing WP CLI and the comment came up, “When setting up a site, it would be nice to install a bunch of plugins with a single command.” Fortunately a WordPress meetup is a great place to bounce ideas off of smart people and find a solution. Solution 1: […]
Recently, I had to find instances of where specific Gravity Forms were being used. This came with multiple challenges. Challenges Searching for gravityform id=”7″ returns results for just gravityform (i.e. too many results) If the gravity form appears in post meta (rather than the primary content), it is excluded (i.e. missing results) SQL Solution Find […]
Historically, when trying to track down a bug in my code I spent a lot of time trying to determine exactly where the bug appears in the code. On all of my projects I use Git for version control. Knowing exactly which commit introduced the bug helps me track down the bug. Git bisect is […]