I followed Jörg W Mittag's answer in this post and have configured meld as the difftool in my git. Now I can view and compare differences of a file in different branches perfectly with this command:
git checkout branch1
git difftool branch1:file.f90 branch2:file.f90
I executed the above command, made and saved changes in meld. However, when I check the file using:
emacs file.f90
The changes I made earlier in meld are not saved at all. I don't understand why this is so; I must have not entirely correctly configured meld as the diff tool. Could any one help me with this problem? Thanks!!
Because you have explicitly given the branches of both files to be diff'ed, meld is working on temporary copies of both files. Try just giving the name of the non-checked out branch:file; this should cause meld to compare a temporary copy of the given branch:file with the checked out file of the same name.
To avoid the need to specify the filename twice, use the following:
git difftool branch -- file
This will compare branch:file
with file
in the working tree.
Furthermore, to diff the entire working tree with branch
, use:
git difftool --dir-diff branch
As mentioned in other answers, if you need to diff branch
with other_branch
(some branch different from what is currently checked out), you must first check out other_branch
before using the above commands.
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