When I use git merge tool and cancel it with Ctrl+C, following files are left in repository:
Can I change the location of these files, so they are not written to the repository at all, even temporarily? For example to ~/.mergefiles
If you don't feel a strong need keep the temporary files from a broken merge at all, you may prefer to delete them entirely. To do so, set the following git config line, which will prevent them from being left behind if the mergetool exits with an error:
git config --global mergetool.keepBackup false
You may need to change some internal settings in your mergetool too, in case it's also saving backups after failed merges. If, on the other hand, you find yourself in need of the temporary files for some reason, this may not be the solution for you.