unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Equivalent of "bzr diff -rancestor:"
@ 2014-11-17 14:45 Stefan Monnier
  2014-11-17 14:58 ` Nicolas Richard
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-11-17 14:45 UTC (permalink / raw)
  To: emacs-devel

I can't seem to figure out how to do the above.

Say, I'm on local branch "foo" which tracks a remote branch "foo", and
I'd like to see what are the changes on this branch foo compared to "master".

In Bazaar, I'd do something like "bzr diff -r ancestor:<master>"
but I can't find any equivalent in "man gitrevisions".

The best I can come up with is to arrange for "foo" to be uptodate with
respect to "master", and then I can just do "git diff <master>", but
sometimes it's inconvenient/impractical to be "uptodate".


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Equivalent of "bzr diff -rancestor:"
  2014-11-17 14:45 Equivalent of "bzr diff -rancestor:" Stefan Monnier
@ 2014-11-17 14:58 ` Nicolas Richard
  2014-11-17 17:24   ` Stefan Monnier
  2014-11-17 15:29 ` Andreas Schwab
  2014-11-17 17:50 ` Teemu Likonen
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolas Richard @ 2014-11-17 14:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I can't seem to figure out how to do the above.
>
> Say, I'm on local branch "foo" which tracks a remote branch "foo", and
> I'd like to see what are the changes on this branch foo compared to
> "master".
>
> In Bazaar, I'd do something like "bzr diff -r ancestor:<master>"
> but I can't find any equivalent in "man gitrevisions".
>
> The best I can come up with is to arrange for "foo" to be uptodate with
> respect to "master", and then I can just do "git diff <master>", but
> sometimes it's inconvenient/impractical to be "uptodate".

Perhaps you want:
git diff origin/foo master

You need to "git fetch" first, so that origin/foo is uptodate.

-- 
Nicolas Richard



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Equivalent of "bzr diff -rancestor:"
  2014-11-17 14:45 Equivalent of "bzr diff -rancestor:" Stefan Monnier
  2014-11-17 14:58 ` Nicolas Richard
@ 2014-11-17 15:29 ` Andreas Schwab
  2014-11-17 17:40   ` Stefan Monnier
  2014-11-17 17:50 ` Teemu Likonen
  2 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2014-11-17 15:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Say, I'm on local branch "foo" which tracks a remote branch "foo", and
> I'd like to see what are the changes on this branch foo compared to "master".
>
> In Bazaar, I'd do something like "bzr diff -r ancestor:<master>"
> but I can't find any equivalent in "man gitrevisions".

Do you mean "git diff $(git merge-base HEAD master)"?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Equivalent of "bzr diff -rancestor:"
  2014-11-17 14:58 ` Nicolas Richard
@ 2014-11-17 17:24   ` Stefan Monnier
  2014-11-17 18:59     ` Nicolas Richard
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2014-11-17 17:24 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-devel

>> In Bazaar, I'd do something like "bzr diff -r ancestor:<master>"

> Perhaps you want:
> git diff origin/foo master

This just shows the diff between the head of both branches.
Whereas I want the diff between the head of "foo" and the common ancestor
between "foo" and "master".


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Equivalent of "bzr diff -rancestor:"
  2014-11-17 15:29 ` Andreas Schwab
@ 2014-11-17 17:40   ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-11-17 17:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

>> Say, I'm on local branch "foo" which tracks a remote branch "foo", and
>> I'd like to see what are the changes on this branch foo compared to "master".
>> In Bazaar, I'd do something like "bzr diff -r ancestor:<master>"
>> but I can't find any equivalent in "man gitrevisions".
> Do you mean "git diff $(git merge-base HEAD master)"?

Hmm... yes, exactly, thanks!
Now the next problem: `C-x v =' doesn't like

   $(git merge-base HEAD master)

:-(


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Equivalent of "bzr diff -rancestor:"
  2014-11-17 14:45 Equivalent of "bzr diff -rancestor:" Stefan Monnier
  2014-11-17 14:58 ` Nicolas Richard
  2014-11-17 15:29 ` Andreas Schwab
@ 2014-11-17 17:50 ` Teemu Likonen
  2014-11-17 18:59   ` Stefan Monnier
  2 siblings, 1 reply; 8+ messages in thread
From: Teemu Likonen @ 2014-11-17 17:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

Stefan Monnier [2014-11-17 09:45:58 -05:00] wrote:

> Say, I'm on local branch "foo" which tracks a remote branch "foo", and
> I'd like to see what are the changes on this branch foo compared to
> "master".

Don't know Bazaar very well so here is my guess about what you may want.
A diff between master's and foo's common ancestor and the tip of foo:

    git diff master...foo           # Three dots.

In other words, it's is a diff between A and B in the graph below.


    o---o---A---o---o----o master
             \
              \--o---o---B foo


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Equivalent of "bzr diff -rancestor:"
  2014-11-17 17:50 ` Teemu Likonen
@ 2014-11-17 18:59   ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-11-17 18:59 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: emacs-devel

> Don't know Bazaar very well so here is my guess about what you may want.
> A diff between master's and foo's common ancestor and the tip of foo:

>     git diff master...foo           # Three dots.

Ha!  That does it, without resorting to running another command to
compute the common ancestor.

This said, "C-u C-x v =" still doesn't like it, because it uses
diff-index rather than diff, and diff-index doesn't seem to like
"master...".


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Equivalent of "bzr diff -rancestor:"
  2014-11-17 17:24   ` Stefan Monnier
@ 2014-11-17 18:59     ` Nicolas Richard
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Richard @ 2014-11-17 18:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Nicolas Richard, emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>>> In Bazaar, I'd do something like "bzr diff -r ancestor:<master>"
>
>> Perhaps you want:
>> git diff origin/foo master
>
> This just shows the diff between the head of both branches.
> Whereas I want the diff between the head of "foo" and the common ancestor
> between "foo" and "master".

Ah, sorry. That is "git diff ...foo"

Quoting "git help diff" :

> git diff [--options] <commit>...<commit> [--] [<path>...]
>            This form is to view the changes on the branch containing and
>            up to the second <commit>, starting at a common ancestor of
>            both <commit>. "git diff A...B" is equivalent to "git diff
>            $(git-merge-base A B) B". You can omit any one of <commit>,
>            which has the same effect as using HEAD instead.



-- 
Nicolas Richard



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-17 18:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 14:45 Equivalent of "bzr diff -rancestor:" Stefan Monnier
2014-11-17 14:58 ` Nicolas Richard
2014-11-17 17:24   ` Stefan Monnier
2014-11-17 18:59     ` Nicolas Richard
2014-11-17 15:29 ` Andreas Schwab
2014-11-17 17:40   ` Stefan Monnier
2014-11-17 17:50 ` Teemu Likonen
2014-11-17 18:59   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).