Using gitconfig per branch
问题 Our company uses many customized opensource project. Whenever I contribute upstream branch I have change to use my personal email/name. Is there any way to have gitconfig per branch? For example what I want is [remote 'gerrit'] name = 'Personal Name' [branch 'origin'] name = 'Name in company' 回答1: You can use post-checkout hook for this. Run $ touch .git/hooks/post-checkout $ chmod a+x .git/hooks/post-checkout Add contents to post-checkout script (edit names and branches as neccessary) #!/bin