Git之filter-branch

  • 修改author和committer
git filter-branch --commit-filter '
export [email protected];
export GIT_AUTHOR_NAME=me;
export [email protected];
export GIT_COMMITTER_NAME=me;
git commit-tree "$@"
' [commit1..commit2]
  • 删除无效的ref
git update-ref -d refs/original/refs/heads/master
  • 删除文件
git filter-branch --tree-filter '
git rm -f --ignore-unmatch password.txt
' [commit1..commit2]

你可能感兴趣的:(Git之filter-branch)