Reputation: 25122
I have a Git repo on BitBucket. I have two branches master
and db
. On my laptop I made changes to db
, commited the changes and pushed up to BitBucket. I can see the commit in that branch.
Now I'm at my desktop at work and I've done a git pull
whilst on branch master. It's pulled down master's commits but not db, which I guess might be the way it should work. I want to get the latest commits on db so I switch to that branch and do git pull
however I get the following message:
You asked me to pull without telling me which branch you want to merge with...
I'm not really sure why this is happening. I created that branch on this machine so should it not just pull down the commits into that branch?
OUTOUT FROM git branch -vva
$ git branch -vva
analytics cea39b9 updated analytics code
* db 6091b29 minor change to the tag creation code
master 0a4070c [origin/master] Merge branch 'master' of https:/
/bitbucket.org/billyjones/findr.fm
remotes/origin/db faf9970 Got tracks working. Now trying to cache prices.
remotes/origin/master 0a4070c Merge branch 'master' of https://bitbucket.org/b
illyjones/findr.fm
It's the faf9970 commit I need to pull
Upvotes: 4
Views: 3665
Reputation: 174299
If your desktop has not yet a local db
branch, you first have to create it:
git branch db origin/db
It might be necessary to perform a git fetch -a
before that.
If the local db
branch already exists make sure that it tracks the corresponding remote branch.
You can verify that via git remote show origin
. Under the heading "Local branches configured for 'git pull':" it should show "db merges with remote db". If that's not the case execute this command if you are on git 1.8:
git branch -u origin/db db
If you are on an older version of git, use this command:
git branch --set-upstream db origin/db
Upvotes: 4