"Giuseppe Bilotta" [off-list ref] 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"