Skip to content

Instantly share code, notes, and snippets.

@zephraph zephraph/pre-commit

Last active Mar 11, 2018
What would you like to do?
Git hook for automatically switching between work/oss accounts depending on the directory
# 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 <Your name>", shell=True)
call("git config <Your work email>", shell=True)
print "Using oss account"
call("git config <Your oss handle>", shell=True)
call("git config <Your oss email>", shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.