thecoshman
thecoshman

Reputation: 8650

Converting from Hg to git, taking opportunity to edit history

So I have a Mercurial repository that I want to convert to git, nothing special there, I know how do that, fast-export as explained here is a brilliant tool for that.

What I want to do, is take this opportunity to correct the endless annoying typos that I have slipped into the commit messages in my Mercurial repository. Does anybody know of a tool, or how to get fast-export, that will let me do this.

I assume something that can export a list of change sets along with the commit messages that I can 'correct' that can then be fed back into a tool would work, as I assume that basically all fast-export does is manually work through your commits anyway.

Once again, I do not just want to move from Hg to git, I also want to edit the commit messages.

Upvotes: 0

Views: 102

Answers (2)

thecoshman
thecoshman

Reputation: 8650

Ok, so I had a look at the histedit and sure, it would probably do the job, but turns out git has the functionality I want built in.

I used the fast-export to convert my Mecurial repository to Git, then used git rebase -i HEAD~14 (14 being the number of commits I had). This let me chose which commits I want to just take as given, which I want to edit the comments for etc. The online git book does a good job of explaining this tool.

Sadly this did not let me edit the very first commit message, but I can live with that one typo.

Upvotes: 1

nmichaels
nmichaels

Reputation: 50991

You can use histedit to modify the hg repository before converting it.

Upvotes: 0

Related Questions