I would like to batch-edit a number of commits to automatically make modifications to author and commit message (being able to apply a few regular expressions would be fine).

I am aware that this is rewriting history, will cause trouble if there are clones, and will change commit ids.

What's the best way to do that?

  • Are author's names in these commits are unique or exist somewhere in history also? – Lazy Badger Oct 3 '15 at 14:23
  • @LazyBadger Either can be arranged. – Nikratio Oct 5 '15 at 18:30
  1. Most easily automated way: MQ

In short:

  • qimport -r REV
  • qrefresh (-u for user, -m|-l for commit message)
  • qfinish+qdelete

with (probably) restoring the correct order of changesets (can't recall where qfinished cset will appear in DAG)

  1. Two-steps (with tricks and limitations) way

Use hg export -g -o <outfile>, process outfile with whatever tool you like, and re-import with hg import <outfile>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.