When calling git difftool
in a repository, git compares the modified files in the local repository with their match in the remote. To do so, it creates a temporary file for the remote, sets the variables LOCAL
and REMOTE
and calls whichever tool is specified for diffs in git's config.
By default, the temporary file is created in /tmp/<hash>_filename
. Is it possible to change this default location?
Why would you do that?
Long story short, I'm using git via windows subsystem for linux and I want to use a windows tool to do diff and merge. The problem is, /tmp
is not accessible from the Windows side, so I'd need to move the default location where git creates temporary files to somewhere accessible by Windows.
What I tried:
So far, all I could find was a suggestion to sudo mount -B /tmp /mnt/c/tmp
but this doesn't seem to work (/tmp
still points to the same directory as before...)
TMPDIR
environment variable? – Cicalagit
config, instead than a system-wide variable.. now all commands I run in the console will use my new tmp location. @Cicala if you add that as an answer I'll at least upvote it (and mark it as actual answer if no other git-only option exists). I'd throw in also a minimal explanation of whatTMPDIR
is for linux-ignorants like me ;) – EvvyLOCAL
andREMOTE
to the paths of the temporary file and the matching file in your repository. It finally calls the command specified in.gitconfig
with the set environment variables – EvvyLOCAL
andREMOTE
as parameters for the two files to diff. My problem is in whereLOCAL
is created, not in calling the external tool – Evvy