When developing code related to the WordPress heartbeat, it is frustrating to make your code changes and then wait for the next heartbeat to occur. You can trigger the WordPress heartbeat in the browser manually to eliminate this delay.
Solution
Shampoo Bottle Protocol
One day I realized that the last 10% of the shampoo bottle lasted at least as long as the first 90%. I suspected this was because most of the time I was using too much shampoo but as I neared the end of the bottle I used a more appropriate amount. How could I trick my brain to always use the appropriate amount?
Remove newline at end of text file
Sometimes when I’m working with files in Git, I find myself with a change in a file that says “No newline at end of file”. This occurs when my editor adds the missing newline at the end of the file. While you should have a newline at the end of the file, you may have a reason for not wanting to add this change. In that case, you can remove the newline from the end of the file.
Git Alias Open Pull Request on GitHub
I want to be able to type “git open-github-pr” and have my browser open to the GitHub URL to create a Pull Request (PR) for my current branch on the current project I’m working on. Here is how I built this.
Your edited hunk does not apply
When using git add -p and faced with a hunk that can not be split sufficiently for your purposes, you can use the e option (manually edit the current hunk). Unfortunately, after manually editing the current hunk it is common to get the message “Your edited hunk does not apply.” I’ve found there are some things I can do to avoid this failure.
Resolving Git Rebase Merge Conflicts
When performing a Git rebase, I often find myself in the situation where I have one or more merge conflicts. This is how I resolve these merge conflicts.
WP CLI Migrate User Roles
Recently on a project I wanted to migrate WordPress users with a certain role to a different role. This is the command I used.
Recover failed Git commit message
When you are using Git commit validation (a.k.a. commit linting) and it fails, it is frustrating to re-type your message. Git stores the commit message that failed validation. You can use this stored message to start your new commit message.
There is no tracking information for the current branch.
When working with Git and you run “git pull” sometimes you get the error message, “There is no tracking information for the current branch.” You can fix this by running a command to set your local branch to track the origin branch of the same name.
Add git status to zsh prompt
One of the things that made me much better at Git was making my current branch (and whether or not I have any changed files) always visible. By default zsh includes everything you need to do this, you just need to configure it.