Subject: Re: git-svn tags and branches

From: Junio C Hamano <[email-masked]>
Date: Wed, 29 Aug 2007 01:59:44 -0700

"Giuseppe Bilotta" <[email-masked]> writes:

> BTW can git have a tag and a branch with the same name? If
> not,...

This is "Yes but".

You can have a tag foo and branch foo.

- "git checkout foo" would switch you to foo branch

- Anything else that lets you use an abbreviated refname 'foo',
  e.g.

  . git branch newbranch foo
  . git log foo
  . git diff foo

  will scold you that 'foo' is ambiguous, while it does not
  outright fail, and takes the first match from the list defined
  in sha1_name.c (ref_fmt[]), so a tag wins over a branch.  You
  can clarify yourself to avoid ambiguity like so:

  . git branch newbranch heads/foo ;# I mean "branch from foo branch"
  . git log tags/foo ;# "show history starting at that tag"