When I type "git diff", I'd like to see a side-by-side diff, like with "diff -y", or like to display the diff in an interactive diff tool like "kdiff3". How can this be done?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
I personally really like icdiff !
If you're on
Mac OS X
withHomeBrew
, just dobrew install icdiff
.To get the file labels correctly, plus other cool features, I have in my
~/.gitconfig
:And I use it like:
git difftool
Open Intellij IDEA, select a single or multiple commits in the "Version Control" tool window, browse changed files, and double click them to inspect changes side by side for each file.
With the bundled command-line launcher you can bring IDEA up anywhere with a simple
idea some/path
You can also try
git diff --word-diff
. It's not exactly side-by-side, but somehow better, so you might prefer it to your actual side-by-side need.If you'd like to see side-by-side diffs in a browser without involving GitHub, you might enjoy git webdiff, a drop-in replacement for
git diff
:This offers a number of advantages over traditional GUI difftools like
tkdiff
in that it can give you syntax highlighting and show image diffs.Read more about it here.
This question showed up when I was searching for a fast way to use git builtin way to locate differences. My solution criteria:
I found this answer to get color in git.
To get side by side diff instead of line diff I tweaked mb14's excellent answer on this question with the following parameters:
If you do not like the extra [- or {+ the option
--word-diff=color
can be used.That helped to get proper comparison with both json and xml text and java code.
In summary the
--word-diff-regex
options has a helpful visibility together with color settings to get a colorized side by side source code experience compared to the standard line diff, when browsing through big files with small line changes.Try git difftool
Use
git difftool
instead ofgit diff
. You'll never go back.UPDATE to add an example usage:
Here is a link to another stackoverflow that talks about
git difftool
: How do I view 'git diff' output with my preferred diff tool/ viewer?For newer versions of
git
, thedifftool
command supports many external diff tools out-of-the-box. For examplevimdiff
is auto supported and can be opened from the command line by:Other supported external diff tools are listed via
git difftool --tool-help
here is an example output: