Hacker News new | ask | show | jobs
by oefrha 2052 days ago
Without using include in gitconfig:

  #!/usr/bin/env zsh
  case $1 in
  foo)
      git config user.name 'John Doe'
      git config user.email john@example.com
      git config user.signingKey 0xFFFFFFFF
      ;;
  bar)
      git config user.name 'Jane Doe'
      git config user.email jane@example.com
      git config user.signingKey 0xEEEEEEEE
      ;;
  baz)
      git config user.name 'My Dog'
      git config user.email dog@example.com
      git config user.signingKey 0xDDDDDDDD
      ;;
  *)
      echo "usage: git-user foo|bar|baz" >&2
      exit 1
      ;;
  esac
Done.

Btw probably want to add signingKey support.