tags:

views:

112

answers:

1

Best to be explained at an example: I am on branch 0.58 of repository and this his how I pull:

git pull origin 0.58

When I just call "git pull", I get:

ip238:openlierox az$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.0.58.merge' in
your configuration file does not tell me either.  Please
name which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:

    branch.0.58.remote = <nickname>
    branch.0.58.merge = <remote-ref>
    remote.<nickname>.url = <url>
    remote.<nickname>.fetch = <refspec>

See git-config(1) for details.

Seems I probably forgot some option (--track ?) when I checked that branch out. Anyway, I have set this now:

git config branch.0.58.merge 0.58
git config branch.0.58.remote origin

And this seems to work. Then, just because of interest, I took a look at some other branch about these setting:

ip238:openlierox az$ git config branch.0.57.merge
refs/heads/0.57
ip238:openlierox az$ git config branch.0.57.remote
origin

I was wondering now, is there a difference between "0.58" or should I specify "refs/heads/0.58"?

What is the difference exactly?

+7  A: 

A ref is anything pointing to a commit, for example, branches (heads), tags, and remote branches. You should see heads, remotes, and tags in your .git/refs directory, assuming you have all three types of refs in your repository.

refs/heads/0.58 specifies a branch named 0.58. If you don't specify what namespace the ref is in, git will look in the default ones. This makes using only 0.58 conceivably ambiguous - you could have both a branch and a tag named 0.58.

Jefromi
Thanks a lot, this explains it very well. It just worked with the simple "0.58" as there is no such named tag.
Albert
Right, it will essentially always be completely fine, but it's good to be safe.
Jefromi