Skip to content

Instantly share code, notes, and snippets.

@lawvs
Last active March 10, 2018 14:12
Show Gist options
  • Save lawvs/279d6983495989d4cb2cc34af1a51f05 to your computer and use it in GitHub Desktop.
Save lawvs/279d6983495989d4cb2cc34af1a51f05 to your computer and use it in GitHub Desktop.
Git核弹级操作
#!/bin/sh
git filter-branch --commit-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="your-correct-name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ];
then
GIT_AUTHOR_NAME="$CORRECT_NAME";
GIT_AUTHOR_EMAIL="$CORRECT_EMAIL";
GIT_COMMITTER_NAME="$CORRECT_NAME";
GIT_COMMITTER_EMAIL="$CORRECT_EMAIL";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
#!/bin/sh
git filter-branch --tree-filter 'rm -f passwords.txt' HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment