修改 Github commit 的作者信息
2017-07-27 14:32
211 查看
原文:http://www.jianshu.com/p/b6add8187c06
配置方法:
但是补救措施只对以后的 commit 起效。
如果想修改之前的作者信息,可以通过脚本重写历史信息:
1. 创建一个你的 repo 的全新裸 clone (repo.git 替换为你的项目,下同)
2.复制粘贴脚本,并根据你的信息修改以下变量:
脚本:
4.按 Enter 执行脚本。
5.查看新 Git 历史有没有错误。
6.把正确历史 push 到 Github:(push 有困难时记得修改 DNS 或者搭梯子)
7.清除临时 clone
配置方法:
git config --global user.email "youremail@google.com" git config --global user.name "your name"
但是补救措施只对以后的 commit 起效。
如果想修改之前的作者信息,可以通过脚本重写历史信息:
1. 创建一个你的 repo 的全新裸 clone (repo.git 替换为你的项目,下同)
git clone --bare https://github.com/user/repo.git cd repo.git
2.复制粘贴脚本,并根据你的信息修改以下变量:
OLD_EMAIL # 历史记录中的邮箱 CORRECT_NAME # 新的用户名 CORRECT_EMAIL # 新的邮箱
脚本:
#!/bin/sh git 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" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags
4.按 Enter 执行脚本。
5.查看新 Git 历史有没有错误。
6.把正确历史 push 到 Github:(push 有困难时记得修改 DNS 或者搭梯子)
git push --force --tags origin 'refs/heads/*'
7.清除临时 clone
cd .. rm -rf repo.git
相关文章推荐
- Git 修改本地和远程的commit的作者信息
- Git修改commit的作者信息
- git修改commit历史信息
- 用python给MP3加封面图片,修改作者,专辑等信息
- 修改git commit信息中的author
- git修改已经提交的commit信息
- GitHub 主页介绍及修改个人信息
- 修改git commit 最后一次提交的注释信息 以及如何退出git bash vim编辑器
- Git往远程push前修改commit信息
- GIT修改commit信息
- 如何修改Git commit的信息
- 修改已经提交到远端的git commit信息
- git 修改commit提交信息
- Git commit --amend 修改提交信息
- GIT修改commit信息
- 【git 学习--03】git commit --amend 修改最后一条提交信息
- windows文件属性信息读取与修改,文件属性标题作者修改
- commit信息修改
- git 修改commit信息
- android studio 导入github项目需要修改gradle信息