
Resgit difftool
Resgit difftool 관련


Git has a mechanism to use a visual diff tool to show diffs instead of just using the command line format we’ve seen thus far. All of the options and features you looked at with git diff
still work here, but it will show the diffs in a separate window, which many people, myself included, find easier to read. For this example, I’m going to use meld
as the diff tool because it’s available on Windows, Mac, and Linux.
Difftool is something that is much easier to use if you set it up properly. Git has a set of config options that control the defaults for difftool
. You can set these from the shell using the git config
command:
git config --global diff.tool meld
git config --global difftool.prompt false
The prompt
option is one I find important. If you do not specify this, Git will prompt you before it launches the external build tool every time it starts. This can be quite annoying as it does it for every file in a diff, one at a time:
git difftool HEAD^ HEAD
#
# Viewing (1/1): 'python-git-intro/new_section.md'
# Launch 'meld' [Y/n]: y
Setting prompt
to false forces Git to launch the tool without asking, speeding up your process and making you that much better!
In the diff
discussion above, you covered most of the features of difftool
, but I wanted to add one thing I learned while researching for this article. Do you remember above when you were looking at the git stash show
command? I mentioned that there was a way to see what is in a given stash visually, and difftool
is that way. All of the syntax we learned for addressing stashes works with difftool:
git difftool stash@{1}
As with all stash
subcommands, if you just want to see the latest stash, you can use the stash
shortcut:
git difftool stash
Many IDEs and editors have tools that can help with viewing diffs. There is a list of editor-specific tutorials at the end of the Introduction to Git tutorial.