Scott
Scott

Reputation: 7264

how do I pull a remote tracking branch while in the master branch

I'm in master and I do a git pull, I get a message indicating I need to pull a remote branch.

Typically I do a git co [branch] then git pull/rebase.

Is there a way to git pull/rebase of [branch] without having to do a git co [branch] first?

Upvotes: 1

Views: 714

Answers (3)

Henrik Gustafsson
Henrik Gustafsson

Reputation: 54108

If you combine Apikot and Jeremy you get:

git pull --rebase origin branch

Or, if you haven't set the branch mapping up in your config:

git pull --rebase origin <src>:<dst>

Upvotes: 2

Jeremy Wall
Jeremy Wall

Reputation: 25237

I don't think there is any way to do an operation on a branch without switching to it. But you can combine the pull and rebase by doing git pull --rebase origin

Upvotes: 0

Andrei Serdeliuc ॐ
Andrei Serdeliuc ॐ

Reputation: 5878

git pull origin branch

Sorry, forgot to mention that pull merges.

If you can use git fetch origin branch to just fetch that branch. http://www.kernel.org/pub/software/scm/git/docs/git-fetch.html

Upvotes: 0

Related Questions