批量修改历史commit的用户名user.name邮箱user.email
生活随笔
收集整理的這篇文章主要介紹了
批量修改历史commit的用户名user.name邮箱user.email
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
配置當(dāng)前的用戶名郵箱可以當(dāng)前項目配置或者全局配置。
僅當(dāng)前項目配置:
git config user.name 'your-user-name' git config user.email 'your-user-email'全局配置:
git config --global user.name 'your-user-name' git config --global user.email 'your-user-email'新建shell腳本 change-email-name.sh 內(nèi)容如下:
#!/bin/shgit filter-branch --env-filter ' OLD_EMAIL="your-old-email" NEW_NAME="your-new-name" NEW_EMAIL="your-new-email"if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] thenexport GIT_COMMITTER_NAME="$NEW_NAME"export GIT_COMMITTER_EMAIL="$NEW_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] thenexport GIT_AUTHOR_NAME="$NEW_NAME"export GIT_AUTHOR_EMAIL="$NEW_EMAIL" fi ' --tag-name-filter cat -- --branches --tags 將腳本放到項目根目錄下,執(zhí)行腳本:./change-email-name.sh
如果執(zhí)行失敗,執(zhí)行以下代碼后再執(zhí)行腳本:
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch Rakefile' HEAD然后強行覆蓋倉庫
git push origin --force --all?
??
??
轉(zhuǎn)載于:https://www.cnblogs.com/Man-Dream-Necessary/p/10045350.html
總結(jié)
以上是生活随笔為你收集整理的批量修改历史commit的用户名user.name邮箱user.email的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [Xcode 实际操作]七、文件与数据-
- 下一篇: layui给select下拉框赋值