Skip to content

Instantly share code, notes, and snippets.

@alecmerdler
Created May 4, 2018 14:41
Show Gist options
  • Save alecmerdler/e94940b9cfb62a2a6aad8b5faa518408 to your computer and use it in GitHub Desktop.
Save alecmerdler/e94940b9cfb62a2a6aad8b5faa518408 to your computer and use it in GitHub Desktop.
git filter-branch -f --env-filter '
if test "$GIT_AUTHOR_EMAIL" != "$GIT_COMMITTER_EMAIL"
then
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
fi
if test "$GIT_AUTHOR_NAME" != "$GIT_COMMITTER_NAME"
then
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
fi' master..HEAD
@alecmerdler
Copy link
Author

A script to take a branch and rewrite the committer to be the author (for when you take someone else’s branch and rebase it for them). Assumes you have a master branch locally and have the branch you want to modify checked out, and that master is an ancestor of the branch.

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