开发者

Is there some way to fake the name / email info for the author of a git commit that I am going to make?

I've done a manual cherry pick of a commit from one project into my git project, and I'd like to give credit to the true author by faking the author info somehow for this one commit, so that the true author is the author, and I am the comm开发者_开发知识库itter.

Any idea how to do this?


There are several ways. If the environment variables GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are set, Git will use those. Also, you can pass the --author argument to git commit as per the documentation:

--author=<author>
Override the commit author. Specify an explicit author using the standard A U Thor <author@example.com> format. Otherwise <author> is assumed to be a pattern and is used to search for an existing commit by that author (i.e. rev-list --all -i --author=<author>); the commit author is then copied from the first such commit found.

However, you don't actually need to do anything because git cherry-pick already does that automatically.


You can specify the author as parameter to git commit:

git commit --author='Erik Vold <ErikVold@gmail.com>' ....
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜