Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tell git that two users are equivalent after cvsimport

Tags:

git

After doing the

git cvsimport

my previous commits are listed belonging to user "user " (user is my unix username).

How can I tell git that these commits are mine (i.e., define a mapping from "user" to my "First Lastname <[email protected]>" git-user)?

like image 867
thias Avatar asked Feb 23 '23 18:02

thias


1 Answers

You can use the -A option to git cvsimport to map user names in CVS to Full Name <email@address> in git. The man page says:

   -A <author-conv-file>
       CVS by default uses the Unix username when writing its
       commit logs. Using this option and an author-conv-file in
       this format

                   exon=Andreas Ericsson <[email protected]>
                   spawn=Simon Pawn <[email protected]>

       git cvsimport will make it appear as those authors had
       their GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL set properly
       all along.

       For convenience, this data is saved to
       $GIT_DIR/cvs-authors each time the -A option is provided
       and read from that same file each time git cvsimport is
       run.

       It is not recommended to use this feature if you intend to
       export changes back to CVS again later with git
       cvsexportcommit.

If you don't want to rerun the import, you can have a look at this answer, which tells you how to rewrite the author information in each commit using git filter-branch. (Note that using git filter-branch for this rewrites the history extensively, so you shouldn't do that if you've already shared the repository with anyone.)

like image 102
Mark Longair Avatar answered Feb 26 '23 19:02

Mark Longair