Skip to content

Instantly share code, notes, and snippets.

@netwjx
Last active December 30, 2015 00:09
Show Gist options
  • Save netwjx/7747185 to your computer and use it in GitHub Desktop.
Save netwjx/7747185 to your computer and use it in GitHub Desktop.
修改git提交历史中的指定用户
#!/bin/bash
export fan=$1
export an=$2
export ae=$3
git filter-branch -f --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "$fan" ];
then
GIT_COMMITTER_NAME="$an";
GIT_COMMITTER_EMAIL="$ae";
GIT_AUTHOR_NAME="$an";
GIT_AUTHOR_EMAIL="$ae";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
@netwjx
Copy link
Author

netwjx commented Dec 2, 2013

sudo ln -s $PWD/change-committer.sh /usr/bin/change-committer

change-committer old_username new_username [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment