Git Grief – Always Pulling to Master

gitLogo.gif

This is something I hadn't run across in - well... forever... If you are on the master branch, and the central repository (that place you cloned from) has changes you haven't received, the natural inclination is to do:

  $ git pull

but if you do this from a simple clone of a repo, and you're on the master branch, then you might very well get the following message:

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

What?! OK, so I'm back to googling as the obvious things weren't working. Thankfully, I found this pretty early on. I simply need to edit my .git/config file and add the section (if it doesn't already exist):

  [branch "master"]
    remote = origin
    merge = refs/heads/master

With this, I can do the "normal":

  $ git pull

and it'll work just fine. Once I pull in the changes, I can then:

  $ git push

and send up my changes as well.

OK. Whew!