Reputation: 2612
I made a few commits, but I realised later on that I haven't had my username setup properly. I changed it and made a few more commits with the right username. Is there any way to change the first commits to use the new username before pushing all of them?
Upvotes: 3
Views: 341
Reputation: 3276
Here's how I would accomplish your goal, it relies on mq
extension, Mercurial's patch queue. (Updated to include @MarkTolonen's fantastic comment!)
Step 0. Back up your work! (you can create a local throw-away clone to try this out)
mq
extension in your config files (see help here)hg qimport
to import into the patch queue the changesets you want to edithg qpop -a
to pull those patches off the applied patch stackhg qpush
hg qref -U
to update the patch's author to the current user (or use hg qref -u <username>
to set it explicityly)hg qfin -a
to finalize the patches into changesetsMy original steps included manually setting the user in a text editor, which were in place of steps 4-6 above:
A. open the folder .hg\patches
, you should have a ###.diff
file for each changeset
B. open those in the text editor of your choice
C. edit the line at the top that starts with # User <your old user name>
and update it to be # User <your new user name>
D. save the patches
E. use hg push -a
to push them back onto the applied stack
Upvotes: 2
Reputation: 97270
Probably the easiest (and fastest) way is convert your repository from Mercurial to Mercurial with special --authormap
for replacing old username with new
Upvotes: 1