Skip to content

Instantly share code, notes, and snippets.

@hpieroni
Created November 20, 2020 02:55
Show Gist options
  • Save hpieroni/676bc3fa4af71e69330de6f6b10ade41 to your computer and use it in GitHub Desktop.
Save hpieroni/676bc3fa4af71e69330de6f6b10ade41 to your computer and use it in GitHub Desktop.
.gitconfigs per directory or repo
# As of git version 2.13, git supports conditional configuration includes.
# In this example we clone Company A's repos in ~/company_a directory, and Company B's repos in ~/company_b.
[user]
name = John Smith
email = john.smith@example.com
# If the pattern ends with /, ** will be automatically added.
# For example, the pattern foo/ becomes foo/**. In other words, it matches "foo" and everything inside, recursively.
[includeIf "gitdir:~/company_a/"]
path = .gitconfig-company_a
# You can set new values or override those in .gitconfig
[user]
name = J.Smith
email = jsmith@companya.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment