简体   繁体   中英

How to git diff between two versions of the same file within the same branch using Tortoise?

I am a recent convert from using an IDE to using Sublime. One of the things that was really useful to me via IDE was their diff tools. For instance in RubyMine you could see the two files next to each other, and color-highlights of the lines that were added/removed.

In Sublime, I was able to install the git package via the package installer and git diff within Sublime. But it still doesn't give me the nice side-by-side view of the +/- lines. I'm wondering how to do this via TortoiseGit Diff. Can someone help? Thanks.

Add this to your global .gitconfig (eg by doing git config --global --edit )

[diff]
    tool = tortoisediff
[difftool "tortoisediff"]
    cmd = \""c:/Program Files/TortoiseGIT/bin/TortoiseGitMerge.exe"\" -mine:"$REMOTE" -base:"$LOCAL"

Then the command git difftool will give you side-by-side diffs in TortoiseGit.

If you want to use TortoiseGit for merging too, you can add:

[merge]
    tool = tortoisemerge
[mergetool "tortoisemerge"]
    cmd = \""c:/Program Files/TortoiseGIT/bin/TortoiseGitMerge.exe"\" -base:"$BASE" -theirs:"$REMOTE" -mine:"$LOCAL" -merged:"$MERGED"

And merge with git mergetool

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM