MySQL: Count number of tables in database

August 18, 2016

If you need to count the number of tables that exist in a MySQL database you can do so with the following query. Just remember to swap out the database name! SELECT count(*) FROM information_schema.tables WHERE table_schema = ‘YOUR_DB_NAME’

Bash script to automatically convert git submodules to regular files

August 3, 2016

Git submodules drive me batty! They are a great idea in theory however in practical application they are a pain in the butt to work with. I have a project that has accumulated over a dozen submodules over the past couple years. Switching branches and merging anything has become excruciating. This morning was the last straw.

Reset all git submodules

June 10, 2016

Here is a quick snippet that will reset all your git submodules to their most recent commit. Handy when something has happened such as a file permissions change that unintentionally affected the submodules. git submodule foreach –recursive git reset –hard

Compare a single file between git branches

June 3, 2016

Comparing a file between two git branches is quite easy. You can do it with both diff and difftool. Straight diff git diff BRANCH_ONE BRANCH_TWO — FILE Using difftool git difftool BRANCH_ONE BRANCH_TWO — FILE

Make an empty git commit

May 11, 2016

Occassionally I have need to mark a specific moment in a git repository. Often this mark is to call out a deployment point. If everything has already been committed I will use an “empty commit” as a marker. Git makes this quite easy and in fact it is built into the commit command. Run the