如何修改Github已经提交的commit里的提交者用户名和提交者邮箱
以這個github commit為例:
https://github.com/SAP/spartacus/commit/4d1de586e32ac635d78ee2ad751338720fb3fb1f.patch
如果由于某種原因,需要刪除上圖高亮的提交者用戶名和提交者郵箱地址,應該如何操作呢?
下面是我聯系了Github support之后得到的解決方案:
注意事項
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.
1 - 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
2 - Create a fresh, bare clone of your repository:
git clone --bare https://github//.git
cd .git
3 - Copy and paste the script, replacing the following variables based on the information you gathered:
- OLD_EMAIL
- CORRECT_NAME
- CORRECT_EMAIL
4 - Press Enter to run the script.
5 - Review the new Git history for errors.
6 - Push the corrected history to :
git push --force --tags origin ‘refs/heads/*’
7 - Clean up the temporary clone:
cd .. rm -rf <reponame>.git總結
以上是生活随笔為你收集整理的如何修改Github已经提交的commit里的提交者用户名和提交者邮箱的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 五菱新能源在印尼交付一批全球车 Air
- 下一篇: 比亚迪发布新一代云巴,已在重庆、深圳、长