在git merge上覆盖作者

And*_*rey 19 git version-control git-merge branching-and-merging git-branch

是否有像git-commit的git-merge这样的选项?

我们维护一个必须执行某些更改的暂存环境.一些限制使我们只使用一个Linux用户来访问登台环境.

无论如何,我们是一个有合作倡议的小团队,我们在做提交时告诉,哪一个是使用--author git-commit选项的作者.但是,有时我们需要从其他分支合并,这会导致非ff合并.这意味着在执行此合并时会执行提交.

在这种情况下,哪个是手动为合并提交指定作者的最佳方法?

Bom*_*mbe 23

首先,阻止合并创建提交:

git merge --no-commit …
Run Code Online (Sandbox Code Playgroud)

然后,手动提交:

git commit --author="A. U. Thor <au@th.or>"
Run Code Online (Sandbox Code Playgroud)


Afr*_*Afr 11

--amend如果您已经进行了合并,那么您可以在之后获得作者身份.像那样:

git checkout master
git merge my_branch
git commit --amend --author="My Nick <my.adress@email.com>"
git push origin master
Run Code Online (Sandbox Code Playgroud)

这可以根据需要工作,并将指定的作者添加到合并提交.没有魔法.:)


kan*_*kan 6

尝试git merge --no-commit ...然后git commit --author ...