I want to run a diff between a commit and my local files, using an external diff-tool, without temp files for my local. I am running git on Windows.
I am currently attempting this using:git difftool --dir-diff <commit> -- <path_to_local_dir>. This approach works fine, however the <path_to_local> is then represented by a temp folder in AppData. For most uses, this is fine.
However, using an external diff tool (in my case BeyondCompare4), the diff tool provides the functionality of "Copying" specific changes from <commit> to <path_to_local>. This is where my issue comes in. If Git forces using temp folders for local files, that "Copying" behavior is useless since it is only modifying the temporary files.
I know I could write a script that copies the contents of temp to my local files after a save, but I am looking for a more elegant solution.
As a sidenote, Mercurial appears to support the requested behavior by default (Only creates Temp files when local files don't already exist)
So, in short, is there a way to force git difftool to actually use local files rather than creating and using temp files for my local files that already exist?
Edit: Word Usage
As I do with many things, I ended up overthinking this issue.
Turns out, as stated in the git difftool documentation, git difftool uses symlinks by default for files in the working tree.
The full explanation of symbolic links is here. The quick explanation is that if you modify a symbolic link to a file, you are effectively and actually modifying that file.
On Windows, the issue becomes a bit more unclear since Git's default behavior is --no-symlinks, but the end result should be the same.
Short answer: Just click Save on the temp file. The changes should show up in your local files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With