Last active
March 11, 2018 03:40
-
-
Save zephraph/ecbc7c1423b1d2eb14388ba118dfdc97 to your computer and use it in GitHub Desktop.
Git hook for automatically switching between work/oss accounts depending on the directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# This file should live at ~/.git/hooks | |
import os | |
from subprocess import call | |
if "git/work" in cwd: | |
print "Using work account" | |
call("git config user.name <Your name>", shell=True) | |
call("git config user.email <Your work email>", shell=True) | |
else: | |
print "Using oss account" | |
call("git config user.name <Your oss handle>", shell=True) | |
call("git config user.email <Your oss email>", shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment