Question

I use git-diffall before, but the author said it was obsolete by the git difftool --dir-diff command.

The command git difftool --dir-diff cannot copy back what I change code in the difftool which like git-diffall's --copy-back option do.

I searched the web, only find this, it seems complex...:

[PATCH] difftool --dir-diff: copy back all files matching the working tree

what do you do when you use difftool and made some changes about the code?

Thanks

Was it helpful?

Solution

The command git difftool --dir-diff cannot copy back what I change code in the difftool which like git-diffall's --copy-back option do.

Modified files are copied back, as long as one of the sides you're diffing is the working tree. That is:

git difftool --dir-diff other-commit

will show other-commit on the left and the modified files in the current working tree on the right. After the tool exits, the files for the right will be copied back to your working tree. (Tested with v1.8.3.2.)

It only makes sense to copy them back when they were originally your working copy: copying files from an arbitrary diff would overwrite your working tree. However, if you want your working tree to be the version from commit2, to compare it with commit1 and to have those changes left in your tree, you could make that clear by checking that version out first:

git checkout commit2 -- specific-file
git difftool --dir-diff commit1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top