How to version control Microsoft Word documents among collaborators

Abstract: Just a quick little tool I use to version control my drafts; highly, highly unlikely to be of use unless you a) use git and want to regularly back up the text of your Word document and b) are working with collaborators who do not use git.

In an attempt to write more, I’m trying to remove barriers. One barrier is worry that if I delete or change something, I’ll want it back, which keeps me from making progress. Version control with git solves this nicely for code and simple text documents, but bulky Word documents do not play nicely with git.

Enter pandoc. This tool converts Word documents to the plain-text document formatting style Markdown. Installing it on Mac OSX 10.10 is pretty easy.

But what if you have a Word document in one folder but you want your Github repo in another folder? (Say, your Word doc is in Dropbox to share with collaborators or among computers easily, but you follow the recommendation to not use Github with Dropbox.) Enter this simple shell script for automating the push to Github:

cp Path_To_Paper/Paper.docx . 
pandoc -s Paper.docx -t markdown -o 
git add . 
git commit -m "$1" 
git push origin master

Call the shell script within your github repo, followed by your commit message. Note that this is smoother if your git config file is set-up such that Github won’t ask for your username and password every time you push.