内容简介:To change the name and/or email address recorded in existing commits, you must rewrite the entire history of your Git repository.Warning: This action is destructive to your repository's history. If you're collaborating on a repository with others, it's co
To change the name and/or email address recorded in existing commits, you must rewrite the entire history of your Git repository.
Warning: This action is destructive to your repository's history. If you're collaborating on a repository with others, it's considered bad practice to rewrite published history. You should only do this in an emergency.
Changing the Git history of your repository using a script
We've created a script that will change any commits that previously had the old email address in its author or committer fields to use the correct name and email address.
Note: Running this script rewrites history for all repository collaborators. After completing these steps, any person with forks or clones must fetch the rewritten history and rebase any local changes into the rewritten history.
Before running this script, you'll need:
- The old email address that appears in the author/committer fields that you want to change
-
The correct name and email address that you would like such commits to be attributed to
-
Open Terminal Terminal Git Bash .
-
Create a fresh, bare clone of your repository:
git clone --bare https://github.com/<em>user</em>/<em>repo</em>.git cd <em>repo</em>.git
-
Copy and paste the script, replacing the following variables based on the information you gathered:
-
OLD_EMAIL -
CORRECT_NAME -
CORRECT_EMAIL
-
- Press Enter to run the script.
- Review the new Git history for errors.
-
Push the corrected history to GitHub:
git push --force --tags origin 'refs/heads/*'
-
Clean up the temporary clone:
cd .. rm -rf <em>repo</em>.git
以上所述就是小编给大家介绍的《修改Git已提交的的Author和EMail(批量修改脚本)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 不修改模板的前提下修改VisualState中的某些值
- ViewGroup 默认顺序绘制子 View,如何修改?什么场景需要修改绘制顺序?
- Per.js 史上最大修改版本,2.1 版本更新,修改 5 项功能
- 通过修改环境变量修改当前进程使用的系统 Temp 文件夹的路径
- Linux下修改时区
- 修改git历史
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
图解网站分析(修订版)
[日] 小川卓 / 沈麟芸 / 人民邮电出版社 / 2014-10 / 69.00元
本书以图配文,结合实例详细讲解了如何利用从网站上获取的各种数据了解网站的运营状况,如何从数据中攫取最有用的信息,如何优化站点,创造更大的网站价值。本书适合各类网站运营人员阅读。 第1 部分介绍了进行网站分析必备的基础知识。第2 部分详细讲解了如何明确网站现状,发现并改善网站的问题。第3 部分是关于流量获取和网站内渠道优化的问题。第4 部分介绍了一些更加先进的网站分析方法,其中详细讲解了如何分......一起来看看 《图解网站分析(修订版)》 这本书的介绍吧!