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.
Solution
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.
Git branch list without asterisk
By default “git branch” will list all of your local branches with an asterisk in front of the current branch. We can remove the asterisk and list only the branch names by adding the “format” parameter.
Git warning: Pulling without specifying how to reconcile divergent branches is discouraged
When using Git version 2.27.0 or higher running the command ‘git pull’ will display, “warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull”.
Git Work Email
I use Git in both my personal and professional life. Depending on the context, I want to use different contact information. This is how I set this up on my machine.
Git Change Default Branch to Main
In Git 2.28 you can change the default branch name from ‘master’ to whatever you want (the name ‘main’ seems to be a popular choice). This is the command to run to add this to your configuration.
Join Strings with Commas and “And” in JavaScript
In English the rules we use for joining a list of items involves more work than a standard join in JavaScript. Here is JavaScript code to join an array of elements with commas and an “and”.