更改名字和邮箱(作者和提交者):
git filter-branch -f --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "xxxxxxxx" ];then GIT_AUTHOR_NAME="yyyyyy";GIT_AUTHOR_EMAIL="[email protected]";GIT_COMMITTER_NAME="yyyyyy";GIT_COMMITTER_EMAIL="[email protected]";git commit-tree "$@";else git commit-tree "$@";fi' HEAD
git filter-branch 会生成备份,可以删除:
删除某个分支备份:
git update-ref -d refs/original/refs/heads/分支
或者(删除所有备份):
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d