Sometimes it is necessary to share git patches locally. Either you cannot push it to the public domain in a feature or master branch or you simply don’t have an internet connection – for example while working in a customer VPN reproducing issues locally.
You could hope for XMPP sending patch files or any other local transport. But if you don’t want to add, commit, format-patch and send a patch file you’ll obviously go for plain text copy paste of a ‘git diff’ output. Editors and messengers tend to destroy the tab indent. Now what?
base64 encoding to the rescue.
michi@mbmif ~/coding/icinga/icinga2 (master) $ git diff | base64
Send the blob to your colleague who can easily apply it. Example on MacOS:
michi@mbmif ~/coding/icinga/icinga2 (master) $ base64 -D | patch -p1
Or if written to a temporary file:
michi@mbmif ~/coding/icinga/icinga2 (master) $ base64 -D < patchfile | patch -p1