Saving your work for later in Git
You’re working on a Git repo. Let’s say you’ve got a lot of uncommitted changes on your machine – maybe you’re spiking a new feature. What’s the best way to get those changes – including new files – onto a different machine, without sending over the whole Git repo? Simple:
work_box $ git diff master ORIG_HEAD > spike.patch [Email the patch to yourself] other_box $ git apply spike.patch
Git’s diff format will even create missing files. Note that this method won’t work for binary files – you’ll just have to send those to your other box.