There are lots of ways to name Git branches. These are my personal rules I’ve developed for naming Git branches.
Recommendations
Don’t Do It Now, Open an Issue Instead
When working on an issue, it is easy to get sidetracked by other unrelated changes that need to be made. I’ve found that instead of addressing other issues as I spot them, taking a moment to open an issue and then ignoring them allows me to stay focused on the task at hand.
Git autoSetupRemote Prevents “no tracking information” Error
After creating a pushing a new branch to GitHub (or any remote), when I do “git pull” I often get an error that says “There is no tracking information for the current branch”. The Git config value “autoSetupRemote”, introduced in Git version 2.38, lets us avoid this entirely error.
Tarenheit: A New Temperature Scale
My son is studying unit conversions in school and as a family we were discussing how you can’t use the same technique (multiplication) when converting between Celsius and Fahrenheit. Out of this conversation came a new temperature scale, Tarenheit (rhymes with Fahrenheit). Tarenheit is exactly 32° less than Fahrenheit.
Yo-yo Intro
I started yo-yoing approximately one week before the original draft of this post. During that time I learned a lot of introductory information from different sources. This is the blog post I wish I had when I started yo-yoing.
Always Bring Your Pull Requests Up to Date
A Pull Request (PR) should always be up to date with the branch into which it is being merged. Another way of saying this is you should be able to merge your PR as a fast-forward merge (even if you decide not to do a fast-forward merge). In this post we’ll look at how a safe looking PR that is out of date can be catastrophic to merge.
Intermediate Git
I’ve been using Git for a number of years. When I was a Git beginner, I followed some prescribed steps and things worked – most of the time. This seems to be a pretty common experience for people starting out with Git. The magical part is when I started to understand Git, when I went from beginner to intermediate. These are some blog posts and videos that would have helped me with that transition.
WordPress Hooks and PHP Namespaces
While PHP namespaces allow you to refer to a function in file without using the fully qualified name, there is a catch when adding a WordPress hook or filter. The PHP __NAMESPACE__ magic constant can be helpful in this situation.
phpunit.xml vs phpunit.xml.dist
As a PHP programmer I’ve seen projects with a phpunit.xml file or a phpunit.xml.dist file (or even both, which is a mistake). These are configuration files for PHPUnit but why the two different file names? PHPUnit first tries to use phpunit.xml and if that file does not exist, then it tries to use phpunit.xml.dist instead. PHPUnit only uses one of these files, never both.
JavaScript Or (||) Versus Nullish Coalescing Operator (??)
The “or” (||) operator and the “nullish coalescing operator” (??) can often be used in similar ways when reading a property from an object that may or may not exist. When dealing with strings you’re typically better off using “or” (||) and for numbers you’re typically better off using the “nullish coalescing operator” (??).