Skip to content

Instantly share code, notes, and snippets.

@arpat
Created October 13, 2016 15:33
Show Gist options
  • Select an option

  • Save arpat/558ba8bceefa4f9da61ee1a5d3573f60 to your computer and use it in GitHub Desktop.

Select an option

Save arpat/558ba8bceefa4f9da61ee1a5d3573f60 to your computer and use it in GitHub Desktop.

Revisions

  1. arpat created this gist Oct 13, 2016.
    28 changes: 28 additions & 0 deletions git.tnt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/bin/sh
    # Blame: [email protected]
    # My version of github change git author script
    # https://help.github.com/articles/changing-author-info/

    if [ $# -eq 0 ]; then
    echo "Usage: OLD_EMAIL CORRECT_NAME CORRECT_EMAIL"
    echo "...and run from the toplevel."
    exit 1
    fi

    git filter-branch --env-filter '
    OLD_EMAIL="$1"
    CORRECT_NAME="$2"
    CORRECT_EMAIL="$3"
    if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
    then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
    fi
    if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
    then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
    fi
    ' --tag-name-filter cat -- --branches --tags