# Re: git-whatchanged does not show merge result?

6 messages from 2005-10-14 to 2005-10-14. Participants: David Ho, Linus Torvalds, Junio C Hamano.
Thread: https://gitlist.dev/t/2108

## David Ho, 2005-10-14 16:33

Subject: Re: git-whatchanged does not show merge result?
Message-ID: <4dd15d180510140933j7a730c49hb9cdaa98ea0a5b07@mail.gmail.com>
URL: https://gitlist.dev/e/4dd15d180510140933j7a730c49hb9cdaa98ea0a5b07%40mail.gmail.com
In-Reply-To: <4dd15d180510140929x2c69f61ag19a1409cfd993e7b@mail.gmail.com>

```
Hi,

Maybe someone can clear up a confusion I have with git-whatchanged.
I created a new repo with just one file hello, split out a new branch "mybranch.
When I merged back the changes from mybranch, git-whatchanged -p did
not should the diff of the merge.
Does it have some special behaviour I am not aware of.  I'd appreciate
if you can clarify.
Notice that git-whatchange does not show the diff between (last
commit) fd494be and 83ac91a1

Thanks, David

git version 0.99.7b

commands used (roughly to repeat the test)

mkdir git-tutorial
cd git-tutorial
git-init-db
echo "Hello World" >hello
git-update-index --add hello
echo "It's a new day for git" >>hello
echo "Initial commit" | git-commit-tree $(git-write-tree) > .git/HEAD
git -m "added It's a new day..." commit hello
git checkout -b mybranch
git checkout mybranch
echo "Work, work, work" >>hello
git commit -m 'Some work.' hello
git checkout master
echo "Play, play, play" >>hello
git commit -m 'Some fun.' hello
git pull . mybranch
vi hello (merge the change by hand...)
git -m "merge work,work,... from mybranch" commit hello

last commit
#cat .git/HEAD
fd494becb20a8d9eddad01921de1cc9fe2cbf354

output from git-whatchanged -p hello

diff-tree 83ac91a13297887760f252aa9026e76235adcdd9 (from
7a78a9c5bb38ad4db1b5c9b14c1d409b2f36c0b0)
Author:  <davidho@penguin.nanometrics.ca>
Date:   Fri Oct 14 12:02:50 2005 -0400

    Some fun.

diff --git a/hello b/hello
--- a/hello
+++ b/hello
@@ -1,2 +1,3 @@
 Hello World
 It's a new day for git
+Play, play, play

diff-tree b12ea5026dbc9ad651fcad6b44a683548fda47a7 (from
7a78a9c5bb38ad4db1b5c9b14c1d409b2f36c0b0)
Author:  <davidho@penguin.nanometrics.ca>
Date:   Fri Oct 14 12:02:22 2005 -0400

    Some work.

diff --git a/hello b/hello
--- a/hello
+++ b/hello
@@ -1,2 +1,3 @@
 Hello World
 It's a new day for git
+Work, work, work

diff-tree 7a78a9c5bb38ad4db1b5c9b14c1d409b2f36c0b0 (from
e45b23ab79bec72ba4ef0a79820a3c172751e59b)
Author:  <davidho@penguin.nanometrics.ca>
Date:   Fri Oct 14 12:00:48 2005 -0400

    Add line "It's a new day..."

diff --git a/hello b/hello
--- a/hello
+++ b/hello
@@ -1 +1,2 @@
 Hello World
+It's a new day for git

```

## Linus Torvalds, 2005-10-14 17:13

Subject: Re: git-whatchanged does not show merge result?
Message-ID: <Pine.LNX.4.64.0510141007290.23590@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0510141007290.23590%40g5.osdl.org
In-Reply-To: <4dd15d180510140933j7a730c49hb9cdaa98ea0a5b07@mail.gmail.com>

```


On Fri, 14 Oct 2005, David Ho wrote:
> 
> Maybe someone can clear up a confusion I have with git-whatchanged.
> I created a new repo with just one file hello, split out a new branch "mybranch.
> When I merged back the changes from mybranch, git-whatchanged -p did
> not should the diff of the merge.

You can use the "-m" flag to show merges. HOWEVER, it's not very useful 
in general, although it _is_ useful on a file-by-file basis. 

What "-m" does is that it will show diffs against each parent, which is 
_sometimes_ what you want. Try it.

		Linus

```

## Junio C Hamano, 2005-10-14 17:24

Subject: Re: git-whatchanged does not show merge result?
Message-ID: <7vd5m8rozb.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vd5m8rozb.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <4dd15d180510140933j7a730c49hb9cdaa98ea0a5b07@mail.gmail.com>

```
David Ho <davidkwho@gmail.com> writes:

> When I merged back the changes from mybranch, git-whatchanged -p did
> not should the diff of the merge.

You probably mean "git-whatchanged -p -m".

I've seen this question asked at least twice in the past.

    SYNOPSIS
    --------
    'git-whatchanged' <option>...

    DESCRIPTION
    -----------
    Shows commit logs and diff output each commit introduces.  The
    command internally invokes 'git-rev-list' piped to
    'git-diff-tree', and takes command line options for both of
    these commands.

    This manual page describes only the most frequently used options.

Perhaps the frequently used options should include '-m' as well.
This part is from git-diff-tree.txt:

    -m::
            By default, "git-diff-tree --stdin" does not show
            differences for merge commits.  With this flag, it shows
            differences to that commit from all of its parents.

```

## David Ho, 2005-10-14 17:31

Subject: Re: git-whatchanged does not show merge result?
Message-ID: <4dd15d180510141031n531b9e0enc8e7d668b1e61b83@mail.gmail.com>
URL: https://gitlist.dev/e/4dd15d180510141031n531b9e0enc8e7d668b1e61b83%40mail.gmail.com
In-Reply-To: <Pine.LNX.4.64.0510141007290.23590@g5.osdl.org>

```
I was a little worried when I did git-whatchanged on a file and there
was a hole in the history where the merge is.  This reassured me that
all changes to the file is accessible (I'm sure they are all stored
safely in the repo =).

Thanks, David

On 10/14/05, Linus Torvalds <torvalds@osdl.org> wrote:
>
>
> On Fri, 14 Oct 2005, David Ho wrote:
> >
> > Maybe someone can clear up a confusion I have with git-whatchanged.
> > I created a new repo with just one file hello, split out a new branch "mybranch.
> > When I merged back the changes from mybranch, git-whatchanged -p did
> > not should the diff of the merge.
>
> You can use the "-m" flag to show merges. HOWEVER, it's not very useful
> in general, although it _is_ useful on a file-by-file basis.
>
> What "-m" does is that it will show diffs against each parent, which is
> _sometimes_ what you want. Try it.
>
>                 Linus
>

```

## David Ho, 2005-10-14 17:39

Subject: Re: git-whatchanged does not show merge result?
Message-ID: <4dd15d180510141039l12748f98x5506df855f488ce2@mail.gmail.com>
URL: https://gitlist.dev/e/4dd15d180510141039l12748f98x5506df855f488ce2%40mail.gmail.com
In-Reply-To: <7vd5m8rozb.fsf@assigned-by-dhcp.cox.net>

```
Sorry, I'm still reading the man pages on
http://www.kernel.org/pub/software/scm/git/docs/.
Thanks for pointing that out.

David

```

## Linus Torvalds, 2005-10-14 18:39

Subject: Re: git-whatchanged does not show merge result?
Message-ID: <Pine.LNX.4.64.0510141138030.23590@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0510141138030.23590%40g5.osdl.org
In-Reply-To: <4dd15d180510141031n531b9e0enc8e7d668b1e61b83@mail.gmail.com>

```


On Fri, 14 Oct 2005, David Ho wrote:
>
> I was a little worried when I did git-whatchanged on a file and there
> was a hole in the history where the merge is.  This reassured me that
> all changes to the file is accessible (I'm sure they are all stored
> safely in the repo =).

Btw, "git-whatchanged" really _can_ hide real stuff, namely when nothing 
changed.

A commit that has no changes at all (which is quite possible) will never 
be shown by git-whatchanged. 

So in many ways, "git log" is the way to see all commits. 
"git-whatchanged" is really just a way to see the _changes_, and by 
defauly it ignores merges just because the changes are "complicated".

		Linus

```
