Mercurial: change username of some commits not yet pushed?
Here's how I would achieve my goal, it relies on mq
extension , the Mercurial patch queue. (Updated to include @ MarkTolonen's wonderful comment )
Step 0. Back up your work! (you can create a local drop clone to try this)
- Include the extension
mq
in your config files (see help here ) - use
hg qimport
to import the changes you want to change into the patch queue. - use
hg qpop -a
to pull these patches from the applied patch of patches. - press the first patch with
hg qpush
- use
hg qref -U
to update the author of the patch to the current user (or usehg qref -u <username>
to install it explicitly) - repeat steps 4 and 5. for each patch in the queue.
- double check your work. Is your username correct in the log?
- use
hg qfin -a
to complete patches in changesets. - you should now be ready to push the updated changes to the public repo
My initial steps involved manually configuring the user in a text editor instead of steps 4-6 above:
and. open the folder .hg\patches
, you should have a file ###.diff
for each changeset
B. open them in a text editor of your choice
C. edit the line at the top that starts with # User <your old user name>
and update it as # User <your new user name>
D. save patches
E. use hg push -a
to put them back on the application stack
source to share
Probably the easiest (and fastest) way is to convert your repository from Mercurial to Mercurial with a special one --authormap
to replace the old username with the new one
source to share