rickumali (130) [Avatar] Offline
#1
I've decided to write a short blog-type post every week here on this forum. These posts are exclusive to this forum, and they will primarily be about the writing of the book.

One of the things that I do with the MS Word manuscript files is compare versions. However, in Git your working directory represents only one commit. How do I compare two commits at the same time? (I can get a rough comparison with git diff, but for this post, how can I use MS Word's comparison tool, which wants an old version and a new version of a file?)

Clearly I need two copies of the MS Word file that I want to compare. I looked briefly at git diff, which somehow compares two files. The code for git diff is in C, with plenty of Git internals. I didn't go down that path, and in the end, I did a possibly low-tech solution:

git clone gitbook gitbook-timetravel


This command created a clone of my repository named gitbook-timetravel. Since it's a clone, I can access any commit. And because its origin remote is my active repo, I can update it at any time by doing a git pull.

With these two directories (gitbook and gitbook-timetravel), I can now compare files using Word. I use the gitbook-timetravel for the older version, leaving gitbook at the current revision.

A solution to a technical problem doesn't have to be technical! Thanks for reading, everyone!