GIT .mailmap works per repo, but not in global, why?

随声附和 提交于 2019-12-07 05:13:40

问题


I have a group of repos and I have a .mailmap file to combine user names.

My .mailmap file works for all the repos, when it is in the root of each.

I tried to put the file in my ~/.gitconfig file and it doesn't work. Im using Git for Windows and in my global .gitconfig file I added this:

>> git config --global mailmap.file "~/.mailmap"

Thats the command I used. Also tried the log shown below.

[log]
    mailmap = ~/.mailmap
[mailmap]
    file = C:/Documents and Settings/<username>/.mailmap

Both lead to the same file location, but it doesn't seem to honor this file when using git-shortlog

Any suggestions? Thanks.

EDIT Never did git this to work on windows. My hack-fix was to keep the mailmap file in the database, and to write it to each repository with a script.


回答1:


Looking into my .gitconfig, I see that all the windows paths are written with two backslashes like

[difftool "kdiff3"]
  path = C:\\Program Files\\KDiff3\\kdiff3.exe

This works for me.

Maybe you should write

[mailmap]
  file = C:\\Documents and Settings\\<username>\\.mailmap

to get things working. As an alternative, you could try the git-style path declaration like

[mailmap]
  file = /c/Documents\ and\ Settings/<username>/.mailmap


来源:https://stackoverflow.com/questions/6524756/git-mailmap-works-per-repo-but-not-in-global-why

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!