spin6lock
spin6lock

Reputation: 155

How to override git author name in local settings?

My git repository is imported from svn. And the username in git log is something like 0129. I want to override it with my setting like John instead of 0129. And I find this:

Is there a way to override a git author's display name in local repository config?

The .mailmap solution works well in git shortlog, but git log still give the same output. Any suggestions?

EDIT I've check Change the author and committer name and e-mail of multiple commits in Git too but I don't want to run git filter branch every time after git svn rebase.

Upvotes: 0

Views: 285

Answers (2)

FerCa
FerCa

Reputation: 2097

You need to specify the mapping of authors in the moment of migrating from svn to git, using git-svn:

  mkdir project_tmp
  cd project_tmp
  git-svn init https://company.project.org/project --no-metadata
  git config svn.authorsfile ~/Desktop/users.txt
  git-svn fetch

And the users.txt file is like this:

  xavier.fuster = xavier.fuster <[email protected]>
  francesc.dalmau = francesc.dalmau <[email protected]>

The first part of the equal is the svn user name, the second part is the git name.

After this you need to do normal clone to leave all the svn stuff behind:

 git clone project_tmp project

Upvotes: 2

uml&#228;ute
uml&#228;ute

Reputation: 31374

have you had a look at the --authors-file when cloning/fetching/rebasing/...?

suppliying the authors-file, will allow you to use sane names. the syntax of the authors-file is something like the following, with 1 author per line:

svn_user_name = JustNameInGit <[email protected]>

Upvotes: 1

Related Questions