Pew Pew Laser Blog

Code. Glass art. Games. Baking. Cats. From Seattle, Washington and various sundry satellite locations.

Past Blogs

Git Tips - Diff.


Let's talk about how to refer to previous commits absolutely using a hash/sha; or relative to your working directory, master, or previous commits.

Here's quick reference on some cool things you can do with Git's diff command:

git diff
The standard form of git diff will show all differences between your current working directory and the index (the files that Git is watching and has staged for your next commit).
git diff --cached
Just the differences that you've staged (files added to the index); what you would be committing if you run "git commit" without "-a" option.
git diff --name-only
Show just the names of files that are different between your working directory and the index (last commit). Or, pass in two hashes to compare files from those two commits.
git diff master --name-only
Show all files changed between master and your current working directory. This is great for reviewing what changed files you're actually going to commit.
git diff HEAD
Both staged and unstaged changes in your repo; what you would be committing if you run git commit -all.
git diff HEAD~1
Compare current files to the ones from the previous commit. Also git diff HEAD^ HEAD.
git diff HEAD master [file]
Show differences between the working directory and master for one file.
git diff [hash]
Diff between current and previous commit.

Note that hash is that long string which identifies a commit if you do git log.

How to Make a Pee-Wee Runt Rover with Johnny-Five.


A small two-wheeled robot powered with an Arduino, on top of a laptop with many stickers. Way back in May of 2015, I attended JSConf US to help with Bocoup's JS IRL Nodebots event. The robot kit was designed by Rick Waldron, and Rick and Francis Gullota soldered pin headers to all the the motor controllers before the event. We helped around 100 attendees build a nice little Nodebot, and everyone got to take home their kit. If you want to build your own, here's what you need:

Once you've got the bot running, there are a number of ways to extend it. Here's one that's controlled with an Xbox 360 controller (code).

Last Month

Next Month