Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override author on git merge

Tags:

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?

like image 758
Andras Gyomrey Avatar asked Feb 25 '12 19:02

Andras Gyomrey


People also ask

Does git merge overwrite?

Usually git does not overwrite anything during merge.

Can you amend a merge commit?

Updated answer for 2020:You can then edit the merge commit as desired via git commit --amend . Find the merge commit you want to edit in the todo list. Insert a new line after the merge commit that contains only break (or b ). Use git commit --amend to edit the merge commit as desired.


1 Answers

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]>" 
like image 61
Bombe Avatar answered Sep 18 '22 17:09

Bombe