git Commit Re-orderer

Although I probably wouldn't need this if I used branches correctly, some times, I want to re-order the commits in a git repository. Say I make some changes and then I correct one small thing in an unrelated file. I would like to cherry pick that one change out so I can push it to somewhere else without my other commits and when I eventually push them out, it will seems as though that small change happened first.

To accomplish this, I wrote a small script called git-reorder. It takes the base commit (that is, the last commit that remains unaffected) and then the commits you would like to follow it immediately. Any other commits are put in chronological order after that.

It works by simply creating a branch called cleanup at the base commit, cherry picking the specified commits into that branch and then cherry picking any commits that weren't specified but that exist between the base commit and the last commit. Currently, it does not move the cleanup back into whatever branch you started in. I have not tested it thoroughly. Check that the log is correct and then execute the three last commands in the script manually subsituting your branch name for $master.

git-reorder Script Follow Link
Thu, 7 May 2009 16:25:53 -0400 View History