Wonderful, thank you very much Konstantin! :) Nando Il giorno mercoledì 5 aprile 2017 12:01:07 UTC+2, Konstantin Khomoutov ha scritto: > > On Wed, 5 Apr 2017 00:22:28 -0700 (PDT) > Ferdinando Santacroce <ferdinando...@gmail.com <javascript:>> wrote: > > [...] > > Supposing there are a branch and a tag called <something>, when I do: > > $ git checkout something > > Git checks out the tag <something>, and not the branch. > > Furthermore, it leaves me in a detached HEAD state. > > > > So, I'm looking for documentation about this behavior, and I'm > > wondering if there's a way to prefer branches over tags or other > > options I can set. > [...] > > This is covered by the gitrevisions manual page > (run `git help revisions`); in particular: > > <refname>, e.g. master, heads/master, refs/heads/master > A symbolic ref name. E.g. master typically means the commit > object referenced by refs/heads/master. If you happen to have both > heads/master and tags/master, you can explicitly say heads/master to > tell Git which one you mean. When ambiguous, a <refname> is > disambiguated by taking the first match in the following rules: > > 1. If $GIT_DIR/<refname> exists, that is what you mean > (this is usually useful only for HEAD, FETCH_HEAD, ORIG_HEAD, > MERGE_HEAD and CHERRY_PICK_HEAD); > > 2. otherwise, refs/<refname> if it exists; > > 3. otherwise, refs/tags/<refname> if it exists; > > 4. otherwise, refs/heads/<refname> if it exists; > > 5. otherwise, refs/remotes/<refname> if it exists; > > 6. otherwise, refs/remotes/<refname>/HEAD if it exists. > > So, if there exists a tag and a branch of the same name, using of an > unadorned ref name would select the tag (rule 3), and if you want to be > precise, use the full name: > > git checkout refs/heads/something > > to pick the branch named "something" over the same-named tag. >
-- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.