How to 'git pull' without switching branches (git checkout)?


I'm used to running git pull and other commands from within a branch I'm working on. But I have set up a development server that several people work on, so I don't want to have to switch branches when I do it.

If I want to update an existing branch on the dev server from the github repository we all use, what would be the right way to do that?

If I run the command git pull github branchname will that simply pull the branch into the current branch?

All of the git examples I can find seem to indicate that you run checkout branchname first, then do the pull. I'm trying to avoid that. As I said, this is an existing branch and I just want to update to the latest version.


I was looking for the same thing and finally found the answer that worked for me in another stackoverflow post: Merge, update, and pull Git branches without using checkouts


git fetch <remote> <srcBranch>:<destBranch>


git fetch origin branchname:branchname

Go to particular revision

Difference between git pull and git pull --rebase