Add git conditional configuration

This commit is contained in:
Wilfried OLLIVIER 2020-02-11 13:15:53 +01:00
parent b5c0c1c7bc
commit 3ecdfd5e3f

View file

@ -25,3 +25,20 @@ git commit --ammend --no-edit
```shell ```shell
git rev-parse HEAD | xclip git rev-parse HEAD | xclip
``` ```
## Conditional Git configuration
Since git 2.13, there is an option to include configuration (or not) based on a condition
Here is an example use case
```txt
# Specific configurations for work and personnal repos
[includeIf "gitdir:~/code/work/"]
path = .gitconfig.work
[includeIf "gitdir:~/code/oss/"]
path = .gitconfig.oss
```
If include, settings in any configuration found file provided by the path
parameter will by append to or will overide current configuration.