thebugfinder
thebugfinder

Reputation: 334

how can I pull from another branch without leaving the current one?

I find myself doing this repeatedly.

I'm in branch dev.

git checkout master
git pull upstream master
git checkout dev
git rebase master

Is there a way I can do a pull as if I were in master, without having to leave dev?

Upvotes: 0

Views: 53

Answers (1)

user3159253
user3159253

Reputation: 17455

... so

git checkout dev
git fetch upstream
git merge upstream/master

Alternatively, as @Makoto suggests, if you want to keep your branch history "linear", you may replace git merge upstream/master with git rebase upstream/master. Also git rebase has a nice -i option which allows you to select which commits you wish to rebase and in which order

Upvotes: 1

Related Questions