How to ‘git pull’ without switching branches (git checkout)?

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

Basically:

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

Example:

git fetch origin branchname:branchname

Leave a Comment