Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jmervine
Created July 22, 2011 00:58
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 jmervine/1098609 to your computer and use it in GitHub Desktop.
Save jmervine/1098609 to your computer and use it in GitHub Desktop.
bash - gitwho
function gitwho() {
personal_email = "<PERSONAL_EMAIL>"
work_email = "<WORK_EMAIL>"
git_current="`git config --global --get user.email`"
if [ "$1" == "" ]; then
echo $git_current
else
if [ "$1" == "switch" ]; then
if [ "$git_current" == "$personal_email" ]; then
email="$personal_email"
else
email="$work_email"
fi
else
email="$1"
fi
git config --global user.email "$email"
git config --global --get user.email
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment