Skip to content

Instantly share code, notes, and snippets.

Created January 15, 2013 17:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/16f801654dcd474ceb6b to your computer and use it in GitHub Desktop.
prepare-commit-msg
#!/usr/bin/env python
import sys, os
sys.stdin = open('/dev/tty')
print "Enter 'foo' for Foo or 'bar' for bar's information."
name = raw_input("Please enter your full name: ")
email = str()
if name.strip() == "foo":
name = "foo fooster"
email = "foo@foo.foo"
elif name.strip() == "bark":
name = "bar barington"
email = "bar@bar.none"
else:
email = raw_input("Please enter your e-mail address: ")
## unset current name / e-mail address
os.system("git config --global --remove-section user")
set_name = 'git config --global user.name "%s"' % (name)
set_email = 'git config --global user.email "%s"' % (email)
## set the name / e-mail address
os.system(set_name)
os.system(set_email)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment