These are the rules I follow when writing Git commit messages. I’ve found these serve me well and are compatible with most projects I work on (if a project has a specific set of rules for writing Git commit messages, those would override any rules I’ve outlined here).
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.
Git Rebase with Blocks
We can’t do a fast-forward merge when the most recent commit on the receiving branch does not appear in the branch we are merging in. One of our options in this situation is to rebase the branch we want to merge in.
Visualizing Git Branching with Blocks
When visualizing Git branches, I find it easier to think of them as stacks of building blocks rather than the traditional Directed Acyclic Graph (DAG) visualizations.
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.
Setting Up a New Mac
I recently setup a new MacBook as my primary machine and I made these notes in the hope they will streamline the process for me in the future.