From 3ecdfd5e3f9c3f02f0fb37574d89fb218ba4f286 Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Tue, 11 Feb 2020 13:15:53 +0100 Subject: [PATCH] Add git conditional configuration --- src/dev/tools/git.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/dev/tools/git.md b/src/dev/tools/git.md index 1fe25e0..f455b8d 100644 --- a/src/dev/tools/git.md +++ b/src/dev/tools/git.md @@ -25,3 +25,20 @@ git commit --ammend --no-edit ```shell 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.