Override author on git merge

半腔热情 提交于 2019-11-30 11:08:01

First, prevent the merge from creating the commit:

git merge --no-commit …

Then, do the commit manually:

git commit --author="A. U. Thor <au@th.or>"

You can --amend the authorship afterwards if you already did the merge. like that:

git checkout master
git merge my_branch
git commit --amend --author="My Nick <my.adress@email.com>"
git push origin master

This works as desired and adds the specified author to the merge commit. No magic. :)

Try git merge --no-commit ... and then git commit --author ...

An alternative could be to set the GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables:

GIT_AUTHOR_NAME="A. U. Thor" GIT_AUTHOR_EMAIL="au@th.or" git merge ...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!