git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Q: "git diff" using tag names
@ 2011-10-28 12:28 Ulrich Windl
  2011-10-28 12:59 ` Alexey Shumkin
  2011-10-28 13:21 ` Jakub Narebski
  0 siblings, 2 replies; 10+ messages in thread
From: Ulrich Windl @ 2011-10-28 12:28 UTC (permalink / raw)
  To: git

Hi,

when using a somewhat older git (of SLES11 SP1 SDK), I could not find a way to "git diff" between two tag names; I can only diff between two commit numbers. I can display a changeset using "git show", but that's not what I wanted.
Is it possible to get the diff I want using older versions, and is such a feature implemented in the current version? If so, since when?

As I'm not subscribed to the list, I'd appreciate CC'ed replies. Thank you.

Greeting
Ulrich

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

* Re: Q: "git diff" using tag names
  2011-10-28 12:28 Q: "git diff" using tag names Ulrich Windl
@ 2011-10-28 12:59 ` Alexey Shumkin
  2011-11-02  7:31   ` Antw: " Ulrich Windl
  2011-10-28 13:21 ` Jakub Narebski
  1 sibling, 1 reply; 10+ messages in thread
From: Alexey Shumkin @ 2011-10-28 12:59 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: git

Tag is a pointer to a commit (if to say simply)

e.g. in my repo
$ git show-ref --tags --abbrev=7
-->8--
676f194 refs/tags/v2.6.7
b23c481 refs/tags/v2.6.8
-->8--

so

$ git diff v2.6.7..v2.6.8
is equivalent to
$ git diff 676f194..b23c481

etc
> Hi,
> 
> when using a somewhat older git (of SLES11 SP1 SDK), I could not find
> a way to "git diff" between two tag names; I can only diff between
> two commit numbers. I can display a changeset using "git show", but
> that's not what I wanted. Is it possible to get the diff I want using
> older versions, and is such a feature implemented in the current
> version? If so, since when?
> 
> As I'm not subscribed to the list, I'd appreciate CC'ed replies.
> Thank you.
> 
> Greeting
> Ulrich
> 
> 

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

* Re: Q: "git diff" using tag names
  2011-10-28 12:28 Q: "git diff" using tag names Ulrich Windl
  2011-10-28 12:59 ` Alexey Shumkin
@ 2011-10-28 13:21 ` Jakub Narebski
  2011-11-02  7:35   ` Antw: " Ulrich Windl
  1 sibling, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2011-10-28 13:21 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: git, Jakub Narebski

"Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> writes:

> When using a somewhat older git (of SLES11 SP1 SDK),

Nb. you can check version of git with "git --version".

>                                                      I could not
> find a way to "git diff" between two tag names; I can only diff
> between two commit numbers. I can display a changeset using "git
> show", but that's not what I wanted.
>
> Is it possible to get the diff I want using older versions, and is
> such a feature implemented in the current version? If so, since
> when?

From the very beginning in Git you can use tag name where you need
commit identifier; Git would use commit that tag points to (will
dereference or peel a tag).

That is not possible in some [censored] version control systems; I am
looking at you, Subversion!


So if you can do

  $ git show v0.9
  $ git show v1.0

you can also do

  $ git diff v0.9 v1.0

and

  $ git log v0.9..v1.0

-- 
Jakub Narębski

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

* Antw: Re: Q: "git diff" using tag names
  2011-10-28 12:59 ` Alexey Shumkin
@ 2011-11-02  7:31   ` Ulrich Windl
  2011-11-02  9:29     ` Alexey Shumkin
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Windl @ 2011-11-02  7:31 UTC (permalink / raw)
  To: Alexey Shumkin; +Cc: git

Hello Alexey,

thank you very much for your reply. I felt I did something wrong, but couldn't find out what it was. Actually it turned out that I had just mistyped one tag name.

Also it seems that both syntaxes work:
git diff v0.4..v0.5
git diff v0.4 v0.5

The question is: How does git disambiguate between tag names, commits and file names? (All may start with a letter)
This seems to work automagically, and I was desparately looking for an option like "--" to separate revisions from file names. I found "SPECIFYING REVISIONS" in git-rev-parse(1), so you don't really have to answer.

Regards,
Ulrich

>>> Alexey Shumkin <Alex.Crezoff@gmail.com> schrieb am 28.10.2011 um 14:59 in
Nachricht <20111028165943.2cc8253d@ashu.dyn.rarus.ru>:
> Tag is a pointer to a commit (if to say simply)
> 
> e.g. in my repo
> $ git show-ref --tags --abbrev=7
> -->8--
> 676f194 refs/tags/v2.6.7
> b23c481 refs/tags/v2.6.8
> -->8--
> 
> so
> 
> $ git diff v2.6.7..v2.6.8
> is equivalent to
> $ git diff 676f194..b23c481
> 
> etc
> > Hi,
> > 
> > when using a somewhat older git (of SLES11 SP1 SDK), I could not find
> > a way to "git diff" between two tag names; I can only diff between
> > two commit numbers. I can display a changeset using "git show", but
> > that's not what I wanted. Is it possible to get the diff I want using
> > older versions, and is such a feature implemented in the current
> > version? If so, since when?
> > 
> > As I'm not subscribed to the list, I'd appreciate CC'ed replies.
> > Thank you.
> > 
> > Greeting
> > Ulrich
> > 
> > 
> 
> 

 
 

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

* Antw: Re: Q: "git diff" using tag names
  2011-10-28 13:21 ` Jakub Narebski
@ 2011-11-02  7:35   ` Ulrich Windl
  0 siblings, 0 replies; 10+ messages in thread
From: Ulrich Windl @ 2011-11-02  7:35 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

>>> Jakub Narebski <jnareb@gmail.com> schrieb am 28.10.2011 um 15:21 in Nachricht
<m3aa8l5k1y.fsf@localhost.localdomain>:
> "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> writes:
> 
> > When using a somewhat older git (of SLES11 SP1 SDK),
> 
> Nb. you can check version of git with "git --version".

Hi!

For the records, it's "1.6.0.2"...

> 
> >                                                      I could not
> > find a way to "git diff" between two tag names; I can only diff
> > between two commit numbers. I can display a changeset using "git
> > show", but that's not what I wanted.
> >
> > Is it possible to get the diff I want using older versions, and is
> > such a feature implemented in the current version? If so, since
> > when?
> 
> From the very beginning in Git you can use tag name where you need
> commit identifier; Git would use commit that tag points to (will
> dereference or peel a tag).

As said before, I was confused by the simplicity: I was looking for an option to specify revisions (as opposed to file names), like "-r" for RCS, but found none. To make things complicated, I had mistyped one tag name without noticing, so I failed to diff, making me think that tag names won't work the way they actually do.

Sorry, and thanks to everybody who helped!

Ulrich

> 
> That is not possible in some [censored] version control systems; I am
> looking at you, Subversion!
> 
> 
> So if you can do
> 
>   $ git show v0.9
>   $ git show v1.0
> 
> you can also do
> 
>   $ git diff v0.9 v1.0
> 
> and
> 
>   $ git log v0.9..v1.0



 

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

* Re: Q: "git diff" using tag names
  2011-11-02  7:31   ` Antw: " Ulrich Windl
@ 2011-11-02  9:29     ` Alexey Shumkin
  2011-11-02  9:34       ` Frans Klaver
  2011-11-02  9:35       ` Junio C Hamano
  0 siblings, 2 replies; 10+ messages in thread
From: Alexey Shumkin @ 2011-11-02  9:29 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: git

> Hello Alexey,
> 
> thank you very much for your reply. I felt I did something wrong, but
> couldn't find out what it was. Actually it turned out that I had just
> mistyped one tag name.
> 
> Also it seems that both syntaxes work:
> git diff v0.4..v0.5
> git diff v0.4 v0.5
> 
> The question is: How does git disambiguate between tag names, commits
> and file names? (All may start with a letter) This seems to work
> automagically, and I was desparately looking for an option like "--"
> to separate revisions from file names. I found "SPECIFYING REVISIONS"
> in git-rev-parse(1), so you don't really have to answer.

Yes, you found right answer. "--" option separates file names from
"commits' names". but it usually necessary when you have branches or
tags named as some of your files.
E.g. you have file "test" and you name branch "test"
so "git log test" will complain that it cannot understand your
intention to see log of what and will fail

$ git log test
fatal: ambiguous argument 'test': both revision and filename
Use '--' to separate filenames from revisions

$ git log -- test
will show log of file test

$ git log test --
will show log of branch test


> Also it seems that both syntaxes work:
> git diff v0.4..v0.5
> git diff v0.4 v0.5
honestly, I do not know the difference (at the moment :))
may be gurus or manual will help to discover it
> 
> Regards,
> Ulrich
> 
> >>> Alexey Shumkin <Alex.Crezoff@gmail.com> schrieb am 28.10.2011 um
> >>> 14:59 in
> Nachricht <20111028165943.2cc8253d@ashu.dyn.rarus.ru>:
> > Tag is a pointer to a commit (if to say simply)
> > 
> > e.g. in my repo
> > $ git show-ref --tags --abbrev=7
> > -->8--
> > 676f194 refs/tags/v2.6.7
> > b23c481 refs/tags/v2.6.8
> > -->8--
> > 
> > so
> > 
> > $ git diff v2.6.7..v2.6.8
> > is equivalent to
> > $ git diff 676f194..b23c481
> > 
> > etc
> > > Hi,
> > > 
> > > when using a somewhat older git (of SLES11 SP1 SDK), I could not
> > > find a way to "git diff" between two tag names; I can only diff
> > > between two commit numbers. I can display a changeset using "git
> > > show", but that's not what I wanted. Is it possible to get the
> > > diff I want using older versions, and is such a feature
> > > implemented in the current version? If so, since when?
> > > 
> > > As I'm not subscribed to the list, I'd appreciate CC'ed replies.
> > > Thank you.
> > > 
> > > Greeting
> > > Ulrich
> > > 
> > > 
> > 
> > 
> 
>  
>  
> 

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

* Re: Q: "git diff" using tag names
  2011-11-02  9:29     ` Alexey Shumkin
@ 2011-11-02  9:34       ` Frans Klaver
  2011-11-02 20:08         ` Alexey Shumkin
  2011-11-02  9:35       ` Junio C Hamano
  1 sibling, 1 reply; 10+ messages in thread
From: Frans Klaver @ 2011-11-02  9:34 UTC (permalink / raw)
  To: Alexey Shumkin; +Cc: Ulrich Windl, git

On Wed, Nov 2, 2011 at 10:29 AM, Alexey Shumkin <alex.crezoff@gmail.com> wrote:

>> Also it seems that both syntaxes work:
>> git diff v0.4..v0.5
>> git diff v0.4 v0.5
> honestly, I do not know the difference (at the moment :))
> may be gurus or manual will help to discover it

As per the git-diff documentation, these two versions behave equally
-- i.e. no differences.

Comparing branches
$ git diff topic master    <1>
$ git diff topic..master   <2>
$ git diff topic...master  <3>
‪1.‬ Changes between the tips of the topic and the master branches.
‪2.‬ Same as above.
‪3.‬ Changes that occurred on the master branch since when the topic
branch was started off it.

Cheers,
Frans

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

* Re: Q: "git diff" using tag names
  2011-11-02  9:29     ` Alexey Shumkin
  2011-11-02  9:34       ` Frans Klaver
@ 2011-11-02  9:35       ` Junio C Hamano
  2011-11-02 20:08         ` Alexey Shumkin
  1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2011-11-02  9:35 UTC (permalink / raw)
  To: Alexey Shumkin; +Cc: Ulrich Windl, git

Alexey Shumkin <alex.crezoff@gmail.com> writes:

>> Also it seems that both syntaxes work:
>> git diff v0.4..v0.5
>> git diff v0.4 v0.5
> honestly, I do not know the difference (at the moment :))
> may be gurus or manual will help to discover it

The latter is the kosher version, as diff is about two "endpoints" and not
about "ranges". The only reason the former is parsed without erroring out
is because too many people are used to type .. between two things without
thinking, learned the notation from "git log", which _is_ about ranges.

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

* Re: Q: "git diff" using tag names
  2011-11-02  9:34       ` Frans Klaver
@ 2011-11-02 20:08         ` Alexey Shumkin
  0 siblings, 0 replies; 10+ messages in thread
From: Alexey Shumkin @ 2011-11-02 20:08 UTC (permalink / raw)
  To: Frans Klaver; +Cc: Ulrich Windl, git

thanks )

> On Wed, Nov 2, 2011 at 10:29 AM, Alexey Shumkin
> <alex.crezoff@gmail.com> wrote:
> 
> >> Also it seems that both syntaxes work:
> >> git diff v0.4..v0.5
> >> git diff v0.4 v0.5
> > honestly, I do not know the difference (at the moment :))
> > may be gurus or manual will help to discover it
> 
> As per the git-diff documentation, these two versions behave equally
> -- i.e. no differences.
> 
> Comparing branches
> $ git diff topic master    <1>
> $ git diff topic..master   <2>
> $ git diff topic...master  <3>
> ‪1.‬ Changes between the tips of the topic and the master branches.
> ‪2.‬ Same as above.
> ‪3.‬ Changes that occurred on the master branch since when the topic
> branch was started off it.
> 
> Cheers,
> Frans

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

* Re: Q: "git diff" using tag names
  2011-11-02  9:35       ` Junio C Hamano
@ 2011-11-02 20:08         ` Alexey Shumkin
  0 siblings, 0 replies; 10+ messages in thread
From: Alexey Shumkin @ 2011-11-02 20:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ulrich Windl, git

Oh, I see

> Alexey Shumkin <alex.crezoff@gmail.com> writes:
> 
> >> Also it seems that both syntaxes work:
> >> git diff v0.4..v0.5
> >> git diff v0.4 v0.5
> > honestly, I do not know the difference (at the moment :))
> > may be gurus or manual will help to discover it
> 
> The latter is the kosher version, as diff is about two "endpoints"
> and not about "ranges". The only reason the former is parsed without
> erroring out is because too many people are used to type .. between
> two things without thinking, learned the notation from "git log",
> which _is_ about ranges.

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

end of thread, other threads:[~2011-11-02 20:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 12:28 Q: "git diff" using tag names Ulrich Windl
2011-10-28 12:59 ` Alexey Shumkin
2011-11-02  7:31   ` Antw: " Ulrich Windl
2011-11-02  9:29     ` Alexey Shumkin
2011-11-02  9:34       ` Frans Klaver
2011-11-02 20:08         ` Alexey Shumkin
2011-11-02  9:35       ` Junio C Hamano
2011-11-02 20:08         ` Alexey Shumkin
2011-10-28 13:21 ` Jakub Narebski
2011-11-02  7:35   ` Antw: " Ulrich Windl

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 NNTP newsgroup(s).