git修改提交作者和邮箱
下面介绍几种常用的解决方式,当然最终还是需要养成切换代码库检查author信息的习惯,主动配置
<span class="hljs-comment">// 设置全局</span>
git config --<span class="hljs-keyword">global</span> user.name <span class="hljs-string">"Author Name"</span>
git config --<span class="hljs-keyword">global</span> user.email <span class="hljs-string">"Author Email"</span>
<span class="hljs-comment">// 或者设置本地项目库配置</span>
git config user.name <span class="hljs-string">"Author Name"</span>
git config user.email <span class="hljs-string">"Author Email"</span>
解决方法一
如果只需要最近一次提交,那么很简单直接使用git commit –amend就可以搞定
<span class="hljs-comment">git</span> <span class="hljs-comment">commit</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">amend</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">author="NewAuthor</span> <<span class="hljs-comment">NewEmail@address</span><span class="hljs-string">.</span><span class="hljs-comment">com</span>><span class="hljs-comment">"</span>