After doing the
git cvs开发者_如何学编程import
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 <first@last.com>" git-user)?
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 <ae@op5.se>
spawn=Simon Pawn <spawn@frog-pond.org>
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.)
精彩评论