Skip to content

Instantly share code, notes, and snippets.

@thinkerbot
Created September 5, 2012 19:07
Show Gist options
  • Save thinkerbot/3642738 to your computer and use it in GitHub Desktop.
Save thinkerbot/3642738 to your computer and use it in GitHub Desktop.
Rewrite recent commits with current pair
#!/bin/sh
##########################################################################
# Example:
#
# git checkout some_branch
# git pair sc
# git reauthor-latest 3
#
n=${1:-0}
shift 1
current_branch=$(git branch | grep '*' | awk '{print $2}')
git filter-branch -f --env-filter "
export GIT_AUTHOR_NAME='$(git config user.name)'
export GIT_AUTHOR_EMAIL='$(git config user.email)'
" "$current_branch"~"$n".."$current_branch" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment