Houman
Houman

Reputation: 66390

How to pull from a branch?

The question sounds too trivial. I wished it was. :)

I have recently created an experimental branch called deals_feature. After a day work, I have commited and pushed the changes back to the server. I even went to the server and did a git log deals_feature and I can see the latest commit log message on that branch.

And now back to the pc, I am trying to get the latest on that branch.

I did a git branch -a to see make sure I am on the branch:

* deals_feature
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/deals_feature
  remotes/origin/master

But when I do a git pull it seems its pulling from Master instead of the branch.

From .
 * branch            master     -> FETCH_HEAD
Already up-to-date.

What am I missing?

Upvotes: 1

Views: 138

Answers (2)

Hauleth
Hauleth

Reputation: 23586

You must specify branch to push using

$ git pull origin deals_feature

Propably pulling when you are in deals_feature branch will work also, but now I don't have time to test it.

Upvotes: 1

Learath2
Learath2

Reputation: 21403

Try git fetch origin and then do git diff origin/deals_feature on your local deals_feature branch. If it outputs nothing then you are on the latest one already.

I always use git fetch + git merge instead of git pull as i see it more flexible when working with multiple remotes and multiple branches.

Upvotes: 1

Related Questions