Mahesh Chavda
Mahesh Chavda

Reputation: 141

How to get directory git branch diff using kdiff

I have configured kDiff3 with my git.

What I need is to see directory difference between two branches. when I run

git difftool <headbranch>

command it opens all files one by one. But that is not I want.

Upvotes: 14

Views: 7932

Answers (4)

pershyn
pershyn

Reputation: 134

I haven't found possibilities to see directory difference between two branches in a directory comparison mode using kdiff3 and standard git tools.

What could be done using standard tools (fix me if I am wrong:) is file by file comparison using difftool, and overview in console using:

git diff --name-status <other-branch>

But I have found Comprehensive Graphical Git Diff Viewer Script, that did the work for me as desired - to compare the whole directory in kdiff3.

The tool is just a shell script that creates branches-to-be-compared snapshots in /tmp folder and runs kdiff3 folder comparison on them.

Checkout the script here

Upvotes: 1

Sedat Kilinc
Sedat Kilinc

Reputation: 2961

Let's say, we have the two branches master and base In order to see the difference between these branches, just execute:

git difftool -d base:src/ master:src/

Then your preset diff tool should get started, in my case kdiff3. Or you can also use the --tool option to start another one: e.g. with vimdiff

git difftool -d --tool=vimdiff  base:src/ master:src/

or with kdiff3 the same way

git difftool -d --tool=kdiff3  base:src/ master:src/

Upvotes: 2

ste
ste

Reputation: 316

git-difftool(1) now satisfies this use case. Just use the --dir-diff (or -d) switch:

-d
--dir-diff
  Copy the modified files to a temporary location and perform
  a directory diff on them. This mode never prompts before
  launching the diff tool.

So for example:

git difftool -d --tool=kdiff3 10c25f0da62929cca0b559095a313679e4c9800e..980de1bbe1f42c327ed3c9d70ac2ff0f3c2ed4e1

See also https://www.kernel.org/pub/software/scm/git/docs/git-difftool.html

Upvotes: 20

edoloughlin
edoloughlin

Reputation: 5891

You could use

git diff --name-status <other-branch>

It lists files with differences, with a status of A/M/D.

Upvotes: 1

Related Questions