In Git 1.7.?
, push.default
has value : nothing, matching, tracking ...
In Git 1.8.?
, push.default
has value : nothing, upstream, simple ...
I custom my .gitconfig
file :
[push]
default = simple
and this will not work in Git 1.7, so I want to to check the git version
and choose which push.default value to use.
There is a similar question: Can gitconfig options be set conditionally?
the answer is use script, is there any other better way?
And I use git --version
, and output this format:
git version 1.8.1.5
Is there a way to check the version?
No, you cannot do this as a git config file is just a dumb text file. If you only have two different configs, it will work out a lot easier for you to just have two different config files and use the correct one on each machine.