Override author on git merge

Andras Gyomrey picture Andras Gyomrey · Feb 25, 2012 · Viewed 7.6k times · Source

Is there an option like --author of git-commit for git-merge?

We maintain a staging environment where some changes must be performed. Some limitations make us to use only one linux user to access staging environment.

Anyway, we are a small team with cooperative initiative and we tell when doing commits, which one is the author using the --author git-commit option. However, some times we need to merge from other branches which result in a non-ff merge. This implies a commit is performed when doing this merge.

Which would be the best way to specify the author manually for the merge commit in this case?

Answer

Bombe picture Bombe · Feb 25, 2012

First, prevent the merge from creating the commit:

git merge --no-commit …

Then, do the commit manually:

git commit --author="A. U. Thor <[email protected]>"