It’s very handy to have a bootable version of OS X on a thumb drive.
I have written how to do this using a program called DiskMaker X, and I have written about how to do it from the command line here, but after doing this a few times I find the most reliable method is the one outlined below. It uses Apple’s built-in disk utility.This works with any version of OS X. Mountain Lion, Yosemite, El Capitan etc. You’ll need an 8G USB thumbdrive.