# remap git to point to g() git () { g "$@" } # git super command # make sure with zsh that the git plugin is not used # as it will override this command g () { if [[ $# -gt 0 ]] then if [[ `uname` = 'Darwin' && $1 = "init" ]]; then command git "$@" # prompt for the username and email to use while true; do echo -n "Will this be a ⚠️ work-related ⚠️ repo? (y/n) " read yn case $yn in [Yy]* ) git_work; break;; [Nn]* ) git_personal; break;; * ) echo "Please answer yes or no.";; esac done elif [[ $1 = "push" ]]; then branch=`command git rev-parse --abbrev-ref HEAD` if [[ $branch = 'master' ]] then while true; do echo -n "Push to 🔥 Master 🔥 ? (y/n) " read yn case $yn in [Yy]* ) command git "$@"; break;; [Nn]* ) echo "❤️ Push-to-Master crisis averted ❤️"; break;; * ) echo "Please answer yes or no.";; esac done fi fi else command git status fi } # git local repo user git_personal () { command git config user.name "Your Name" command git config user.email "you@personal-domain.com" } # git work repo user git_work () { command git config user.name "Your Professional Name" command git config user.email "you@work-domain.com" }