日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

如何修改Github已经提交的commit里的提交者用户名和提交者邮箱

發(fā)布時間:2023/12/19 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 如何修改Github已经提交的commit里的提交者用户名和提交者邮箱 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

以這個github commit為例:

https://github.com/SAP/spartacus/commit/4d1de586e32ac635d78ee2ad751338720fb3fb1f.patch

如果由于某種原因,需要刪除上圖高亮的提交者用戶名和提交者郵箱地址,應該如何操作呢?

下面是我聯(lián)系了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
#!/bin/shgit filter-branch --env-filter 'OLD_EMAIL="your-old-email@example.com"CORRECT_NAME="Your Correct Name"CORRECT_EMAIL="your-correct-email@example.com"if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]thenexport GIT_COMMITTER_NAME="$CORRECT_NAME"export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"fiif [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]thenexport GIT_AUTHOR_NAME="$CORRECT_NAME"export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"fi' --tag-name-filter cat -- --branches --tags

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

總結(jié)

以上是生活随笔為你收集整理的如何修改Github已经提交的commit里的提交者用户名和提交者邮箱的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。