user482594
user482594

Reputation: 17486

Make not-master-branch to pull from master branch

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

Upvotes: 0

Views: 758

Answers (2)

manojlds
manojlds

Reputation: 301147

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.

Upvotes: 1

kclair
kclair

Reputation: 2224

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

Upvotes: 0

Related Questions