git command of the day: #9

Author: Jeff Anderson

git-mv

Git mv is a wonderful command. Here's how I've been using it.

I'm converting a mediawiki instance to a git repository with all the documents in RST. I used fuse-wikipediafs to grab each article. I added the text of each mediawiki article into a git repository under a subdirectory "wiki_markup". I am converting and verifying each document by hand. My workflow is like this:

git mv wiki_markup/Article.mw article.rst
gvim article.rst
git add article.rst
git commit -m "converted article"

This makes for a clean git commit history. The mediawiki markup is tied to the history of the restructuredtext file. When I do a git log on article.rst, I'll see that in its first commit it was renamed/updated in the same commit. This leaves a trail from the old mediawiki incarnation of this particular document that leads into the current restructured text version.

The advantage to using git mv instead of mv is that it keeps git in the loop with what you are doing with your files. It keeps the workflow nice and smooth, which helps maintain a clean file revision history.

Posted: Feb 26, 2009 | Tags: git

Comments are closed.