0

Did someone manage to configure git to use something like

[includeIf "onbranch:feature/"]
   path = ~/.features.gitconfig

I am attaching a tar.gz with a docker's container. You can docker import it to be able to see the configuration that I have problems running with.

Download docker

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
kornicameister
  • 305
  • 1
  • 15
  • To supplement previous post. I tried to test it by creating a branch called `feature/test`. According to git docs, a condition ending with `/` (forward slash) actually is `/**`. That said, IMHO, being on a branch `feature/test` should activate the configuration posted above. – kornicameister Mar 10 '20 at 20:56
  • Make sure the Git version you're using is recent: the includeIf and some of its fancier things don't exist or don't work in some Git versions that are still pretty commonly used. Otherwise, this does look like it should work, yes. – torek Mar 10 '20 at 21:04
  • honestly...why haven't I thought about it :). – kornicameister Mar 10 '20 at 21:11
  • bumping from `2.17` to `2.25` does the trick. All you gotta do is `add-apt-repository ppa:git-core/ppa` – kornicameister Mar 10 '20 at 21:12
  • @torek would you mind answering in a regular way so that I can vote up? – kornicameister Mar 10 '20 at 21:14

1 Answers1

1

Make sure you're on Git version 2.23 or later:

  • Git 2.13 added the overall includeIf idea; but
  • Git 2.23 is where branch conditionals (includeIf.onbranch:...) first appeared.

(Git 2.22 fixed ** operation in these conditionals, but obviously branch conditionals are required in the first place, so there's no issue there.)

torek
  • 448,244
  • 59
  • 642
  • 775