While Git supports aliases and I am a big fan of Git aliases, (e.g. ‘git lg’), the most valuable to me (and most used) aliases are shell aliases (e.g. ‘gc’ for ‘git commit’).
GitHub Tab Size Preference
As a WordPress developer, I deal with lots of code indented with tabs (rather than spaces). By default when viewing these files in GitHub, each tab is rendered as 8 spaces. On my personal machine, I render each tab as 4 spaces. This difference makes it less pleasant to view code in GitHub, however, I just learned I can set my preferred tab rendering in GitHub!
Git Rebase and the Multiverse
In “Git Merge and the Multiverse” I looked at merging branches and how sometimes this results in a fast-forward merge and sometimes in the creation of a merge commit. Now let’s look at Git rebase (a.k.a. the power to rewrite history).
Git Merge and the Multiverse
If you’re a fan of science (or science fiction), you may be familiar with the concept of the “Multiverse”, the idea that there are multiple universes. In some science fiction stories, one universe can split, branching into multiple universes and then later collapse into a single universe, this is a surprisingly good analogy for Git and branching.
Set Number of Characters in Commit Hash for git log
When I’m writing examples, it is often nice to have very short commit hashes. The ‘–abbrev=3’ argument, passed after the ‘–oneline flag, allows me to reduce the number of characters in the commit to 3.
WordPress Multisite Skip Confirmation Email
When creating a new user on WordPress multisite there is a “Skip Confirmation Email” checkbox that is unchecked by default. This unchecked box results in a user being added to a temporary “signups list” when they are added to the site. The user is not fully added to the site until they complete the confirmation steps in the email they receive. For many sites, it is preferable to check this “Skip Confirmation Email” when adding a user. With some code you can set this checkbox to default to checked.
I Feel Mislead by Agatha Christie
I feel mislead by Agatha Christie. I’m over halfway through reading “The Murder of Roger Ackroyd” and there hasn’t been a single crow yet.
GitHub Link to Commit instead of Branch
When linking to specific lines in a file to GitHub, it is preferable to link to those lines in the file for a specific commit (rather than for a specific branch). This is because the contents of a branch can change but the contents of a commit remain the same forever.
Why PHP require autoload.php should be wrapped in is_readable()
When using Composer for PHP class autoloading, it is a good practice to wrap your require statement with an is_readable() check. Here are some notes on why this is an important thing to do.
How to Close and Re-Open WordPress Gutenberg Sidebar
The sidebar gets a lot of use in the WordPress Block Editor, a.k.a. Gutenberg, but I found myself in a situation where I needed to programmatically close the sidebar and then re-open it later. This is how I did it.