Mario Parra Mario Parra - 1 month ago 5
Git Question

Pulling and working from git branch

I'm trying to fully understand git branching, but the part of the workflow that I don't grasp yet is how to pull an existing branch. I've cloned a repo and used

git pull origin [branch]
, and then checked out into it, but I still only have the master files. I'm obviously missing something. Do I need to update the remote origin? I don't want to merge the branch yet.

I've Googled around, but everything I found shows how to create branches locally and then merge them, but not work off existing ones.


A pull would merge a remote tracking branch into the current one (master)

Do a git fetch to get all the branches: see them with

git branch -avv

(-a for "all", local and remote tracking branches fetched from the remote repo)

Then, to work on any of those remote tracking branches:

git checkout -b abranch -t origin/abranch