Originally when I started using Git with my WordPress projects, I checked in all the files (WordPress core, plugins, themes, and even uploads). Over time I’ve found that to be less than ideal. My preferred .gitignore file appears below and it ignores everything by default. This allows me to whitelist only those plugins and themes […]
Git
How To Use Git Bisect
Historically, when trying to track down a bug in my code I spent a lot of time trying to determine exactly where the bug appears in the code. On all of my projects I use Git for version control. Knowing exactly which commit introduced the bug helps me track down the bug. Git bisect is […]
Improve Git Log
By default the output of ‘git log’ is not nearly as useful as it could be. By creating a new command ‘git lg’ that uses some of the options available to ‘git log’, we create a much more useful command.
WP Engine Syntax Error Composer autoload_static.php
While working with a client recently, I found that deploying to WP Engine with Git had stopped working. The Symptom The following appeared on the command line when I ran git push production remote: – warning: syntax Error Found in wp-content/vendor/composer/autoload_static.php … remote: – failed: we detected a PHP syntax failure. The Problem The file […]
Git Case Sensitive Rename
One can rename a file with git mv however, if you try to use this technique to change the case of the filename it will fail and you’ll get fatal: destination exists. I prefer to keep all my filenames lowercase, so getting this to work is important to me. If I modified the filename case […]
Git file force as binary
Goal Mark generated (concatenated and minified) JavaScript files and CSS files as binary files within Git to allow checking them in while avoiding merge conflicts (currently, I don’t check these files in). Failure I have been unable to get this to work so I thought I’d document my issue here and update this page when […]
Git Submodule fatal: Could not read from remote repository
Why to Setup Your Git Submodules as https:// not ssh I was pulling a public GitHub repo the other day which featured submodules. The frustrating problem is whenever I tried to init the submodules with the line git submodule update –init –recursive I got the error Git Submodule fatal: Could not read from remote repository […]
Undo Git Commit
That is Not What I Meant to Commit It seems no matter how many times I do git status, I still managed to sneak in a completely wrong commit sometimes. Additionally, I never remember how to undo a commit so I end up googling “undo git commit” and I get way more information than I […]
Git Conflict Compiled Sass Files
I’ve been using both Git and Sass for some time now. These two tools have had a huge positive impact on my development. The issue that arises when combining Git and Sass is when checking in compiled CSS, it is common to get conflicts with other contributors on the Git repository. Don’t Check in Your […]