0

When I git pull from a branch that is not master, I get following response.

You asked me to pull without telling me which branch you want to merge with, and 'branch.not_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 ').

What I want to configure is to let this branch to accept pull from the master, as well as its remote branch.

Is it possible to do that?

for instance

//on a branch A that is not master.
git pull master //pull from remote HEAD and merge without warning
git pull        //pull from A and merge
user482594
  • 16,878
  • 21
  • 72
  • 108
  • see: http://stackoverflow.com/questions/7388278/git-pull-you-asked-me-to-pull-without-telling-me-which-branch-you-want-to-merge it give a good method solve this problem – gardeniaxy Oct 17 '12 at 10:55

2 Answers2

1

Like the message says, setup branch.not_master.merge to refs/heads/not_master so that when you do git pull it will pull from the same branch on the remote ( also make sure branch.not_master.remote is set to the remote, say, origin )

For pulling in other branch, you have to write it as git pull origin master, as you cannot omit the remote in this case.

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • I accidently did. `git config branch.not_master.merge to refs/heads/master` What does that mean? It seems that I cannot commit from not_master branch because it is [rejected] and (non-fast-forward).... I think I made a big mistake – user482594 Dec 22 '11 at 03:37
0

git pull should be used when pulling from a remote repository. you need to specify the remote resource, for example:

git pull origin master

git merge can take just the local branch name, and doesn't need the remote resource:

git merge master

kclair
  • 2,124
  • 1
  • 14
  • 18