Skip to content

Instantly share code, notes, and snippets.

@vjm
Last active November 6, 2018 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vjm/37843e939c7868d3f4e2 to your computer and use it in GitHub Desktop.
Save vjm/37843e939c7868d3f4e2 to your computer and use it in GitHub Desktop.
Git Fu

Readme

Add a work alias to git: bash <(curl https://gist.githubusercontent.com/vjm/37843e939c7868d3f4e2/raw/setup_work_alias.sh)

Update an author: OLD_EMAIL=old.email@gmail.com CORRECT_EMAIL=new.email@work.com CORRECT_NAME="My Name" bash <(curl https://gist.githubusercontent.com/vjm/37843e939c7868d3f4e2/raw/rewrite_author.sh)

#!/usr/bin/env bash
alias kraken="open -a 'GitKraken' --args -p $(pwd)"
`subl ~/.gitconfig`
[alias]
ihm = "!git config user.email vincemontalbano@iheartmedia.com && git config user.name 'Vince Montalbano'"
personal = "!git config user.email vince.montalbano@gmail.com && git config user.name 'Vince Montalbano'"
#!/bin/sh
git filter-branch --env-filter '
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
#!/usr/bin/env bash
echo "Enter your work email:"
read email
git config --global alias.work "config user.email \"$email\""
echo "You can now set a local repository to use your work email by typing \"git work\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment