Unable to understand how Git difftool configurations are configured

I needed to use the following in my old Git similar settings in order to use diffftool. The settings are not exactly the same, as I accidentally deleted my old .gitconfig.

[merge] tool=opendiff [mergetool] tool=opendiff [difftool] difftool=opendiff 

I have an empty .gitconfig in Home. I can use opendiff -tool as well. This is a surprise, as it should be impossible.

How do git difffftool options work?

+2
git macos
Jun 30 '09 at 13:13
source share
2 answers

You can see the full customization with mergetool and difftool here .

If the configuration is still active, this may be due to the fact that it is configured globally or in your account, since there are three files where git -config will look for configuration parameters:

 $GIT_DIR/config 

Repository configuration file. (The file name, of course, refers to the root of the repository, and not to the working directory.)

 ~/.gitconfig 

Custom configuration file. Also called a "global" configuration file at the Git installation location:

 $(prefix)/etc/gitconfig 

System configuration file.




Git saves user information wherever you say, to save it when you type ' git config ':

From the git configuration page of the manual :

The file parameter can be one of --system , --global or --file , which indicates where the values ​​will be read or written.
By default, the configuration file for the current repository, .git / config is used, unless otherwise specified by GIT_DIR and GIT_CONFIG .

You can override these rules with either command line options or environment variables. The --global and --system restrict the file used for a global or system-wide file, respectively.
The GIT_CONFIG environment GIT_CONFIG has a similar effect, but you can specify any file name you want.

Perhaps you had an environment variable set in your previous installation?

 GIT_CONFIG 

Take the configuration from this file instead of .git/config . Using the --global causes this to ~/.gitconfig . Using the --system option forces this to $(prefix)/etc/gitconfig .

Note: for Mac OsX $(prefix) should be /usr/local (if you installed Git as described here )

 make prefix=/usr/local all sudo make prefix=/usr/local install which git 
+5
Jun 30 '09 at 13:18
source share

You also have (in addition to remembering in many places in Git searching for a configuration, as indicated in the VonC answer ) to remember that both git-difftool and git-mergetool provide some auto-detection / auto-detection (in some fixed order of preference), which tools do you have are available.

Perhaps that is why "git diffftool" calls opendiff on your computer.

+3
Jun 30 '09 at 14:06
source share



All Articles