git 修改历史提交人
git 修改历史提交人准备将 git 工程设置成 正确的提交人:git config user.name "xxxx"git config user.email "xxx@email.com"修改最后一次提交人git commit --amend --reset-author如果想要修改历史,就需要通过 rebase 操作选择性修改git rebase -i HEAD~N,如 git rebase
·
git 修改历史提交人
准备
将 git 工程设置成 正确的提交人:
git config user.name "xxxx"
git config user.email "xxx@email.com"
修改最后一次提交人
git commit --amend --reset-author
如果想要修改历史,就需要通过 rebase 操作
选择性修改
git rebase -i HEAD~N
, 如git rebase -i HEAD~5
, 显示历史的前5个提交记录
- 将要修改的提交的 pick 改成 edit :
:wq
保存退出
Stopped at eb8e529... init jery
You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
-
git commit --amend --reset-author
, 在操作页面,:wq
保存退出 -
git rebase --continue
回到正常状态 -
git rebase --abort
放弃本义修改
所有分支全部替换
git filter-branch --env-filter '
OLD_EMAIL="xxx"
CORRECT_NAME="xxxx"
CORRECT_EMAIL="xxx"
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条内容
所有评论(0)