Re: git-diff across branches?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 08, 2008 at 05:44:14AM -0300, Gonzalo Garramuño wrote:

> I was wondering if there was a way to make a git-diff across (local)  
> branches.
>
> Something like:
>
> $ git-diff --branch test1 HEAD --branch test2 HEAD  file.cpp
> (would show a diff for file.cpp between test1 HEAD and test2 HEAD)

I think you are mistaken about how HEAD works; it is a pointer to a
particular branch. So there is no "HEAD" for test1; there is simply
test1, and from time to time your repository's HEAD points to test1.

However, that makes things easier. You can simply do this:

  git-diff test1 test2 file.cpp

Unless you mean that you have two separate repositories, test1 and
test2. In which case each _does_ have its own HEAD, and you will have to
fetch from one repo into the other to get your answer:

  # go into one of the repos
  cd test1
  # fetch the 'master' ref from the other repo and store it in this repo
  # using the name 'test2'
  git fetch ../test2 master:test2
  # now we can diff between them
  git diff HEAD test2 file.cpp

-Peff
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux