Changing commit authors in Git
One of the projects I work on, Axiom Stack, has been through three different version control systems. It was originally hosted in Subversion. We moved to Baazar about half a year ago because we needed a sane branching/merging system. Now we’re switching again, this time to Git.[*]
With our share of migrations between VCSes and authentication systems, the history of Axiom Stack was full of totally inconsistent representations of commit authors. Depending on what we were using at at the time (and how I reassured the system that I was Me) my commits were by
It turned out to be surprisingly easy to do, albiet something you shouldn’t do to an existing public repository that people are tracking. I used git’s fast-export to dump the entire repo out to a text file, sliced and diced it, and recreated it with fast-import. To wit:
$ cd git-repo-directory
$ git fast-export --all > ../git-export.tmp
$ cd ..
# change the author and commit credit lines to some consistent
# representation of each user. For me, Batman-style text editing:
# SED! AWK! GREP!
$ mkdir fixed-authors-repo
$ cd fixed-authors-repo
$ git init
$ git fast-import < ../git-export.tmp
---
[*] There's nothing wrong with Baazar. It was simply that Git's speed and in-place branch switching turned out to be must-haves.
Posted: March 20th, 2009 under Uncategorized.
Comments: none
Write a comment