Can I change the username on a mercurial changeset?

后端 未结 4 1098
挽巷
挽巷 2020-11-29 18:12

I didn\'t set the username on my development computer and made a few commits. Can I retroactively change the username so it\'s clear who committed these changesets?

4条回答
  •  佛祖请我去吃肉
    2020-11-29 19:05

    I've used the histedit extension which allowed me to change the author without making new repos like "convert" would or resorting to "mq".

    First, in your Mercurial config file, make sure your username is set correctly and enable the histedit extension:

    [ui]
    username = Your Name 
    
    [extensions]
    histedit =
    

    Then, if you want to change revision 40, use:

    hg histedit -r 40
    

    In the file that appears, on the line corresponding to revision 40, change the word pick to edit. Save and close the file.

    Now, hg commit. You'll need to re-enter your commit message and save.

    Finally, hg histedit --continue.

    The commit will appear with your new username. A side-effect is the timestamp of the commit is also updated.

提交回复
热议问题