1

When I am not on the master branch, git sometimes complains

"You asked me to pull without telling me which branch you want to merge with, and 'branch.basics.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 '). See git-pull(1) for details."

Just wondering if it is possible to configure git so it does always merge with the associated remote branch from origin. As an example: If I am at branch basics (which I currently am ;-) ) and I make a git pull. Now I want git to fetch this branch from origin and merge it with the same local branch.

Cheers, Rudolf

nanoquack
  • 949
  • 2
  • 9
  • 26

1 Answers1

5

You can specify the upstream branch (see "How do you make an existing git branch track a remote branch?"):

git branch --set-upstream basics origin/basics

Or, the first time you push your branch (see "Git: Why do I need to do --set-upstream all the time?"):

git push -u origin my_branch
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you! git push -u sounds very nice! Is there a possibility to automate this? So it automatically sets the upstream? – nanoquack May 09 '12 at 12:00
  • 1
    @nanoquack you only need to push *once* with the `-u` option. After that, a classic `git push` will be enough. – VonC May 09 '12 at 12:11