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

Find largest files in a directory using the terminal

June 1, 2016

If you need to find out what the largest files are in a directory and subdirectories here is a command you can run that will find the top 5 largest files. find . -type f | sed ‘s/.*/”&”/’ | xargs ls -Slh | head -n 5 Breakdown: find . -type f: Find all files in

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

Quick recursive PHP file syntax check

May 10, 2016

I find it handy to run a PHP syntax (lint) check on files after resolving a merge conflict in git. Here is a handy snippet that will run find every file in the current and sub-directories and run them through the PHP command line syntax checker. find . -iname “*.php” -exec php -l {} \;

MySQL: Find the size of a database

April 28, 2016

MySQL has the ability to show you size of the information contained in your database. You can find this information per database or per table in a database pretty easily. Size of databases To list the size of all the databases on the server run the following: SELECT table_schema “Database”, sum( data_length + index_length) /