Override author on git merge

后端 未结 4 1904
别跟我提以往
别跟我提以往 2021-02-12 13:56

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 onl

相关标签:
4条回答
  • 2021-02-12 14:28

    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 ...
    
    0 讨论(0)
  • 2021-02-12 14:35

    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. :)

    0 讨论(0)
  • 2021-02-12 14:50

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

    0 讨论(0)
  • 2021-02-12 14:51

    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>"
    
    0 讨论(0)
提交回复
热议问题