add the old snippet md files

This commit is contained in:
Travis Shears 2025-06-05 16:20:57 +02:00
parent fc0dd204c7
commit bcf8313a4b
110 changed files with 3048 additions and 0 deletions

View file

@ -0,0 +1,37 @@
---
title: "per company git config"
seo_description: "how to configure git to use different emails per company / folder"
date: 2022-06-03T10:49:40+02:00
draft: false
snippet_types:
- git
---
Started new job this week and I wanted to have a seprate email on my work related repos then my
personal ones. Cool thing is git supports
[conditional config file includes](https://git-scm.com/docs/git-config#_conditional_includes)!
**~/.gitconfig**
```gitconfig
# per-user git config
[user]
name = Travis Shears
email = t@travisshears.com
[includeIf "gitdir:~/company-x/"]
path = .gitconfig-company-x
```
**~/.gitconfig-company-x**
```gitconfig
# Company X spefic git config
[user]
name = Travis Shears
email = travis.shears@company-x.com
```
Now any commits made under the directory **~/company-x** will use the email
**travis.shears@company-x.com** and not my personal email.
[source](https://stackoverflow.com/questions/8801729/is-it-possible-to-have-different-git-configuration-for-different-projects)