Q:

Git/Github - Proper way to checkout current remote branch

We are using a simple Github flow where the remote Github repository has Master (for production) and Develop (for development).
I want to checkout branches from Develop (remote) and merge my changes back into Develop (remote).
What's the proper way to checkout a new branch from Develop (remote) so that I know I have the current remote status of the branch?  

for reference I'm trying to use this flow http://nvie.com/posts/a-successful-git-branching-model/ . Perhaps I should just modify $ git checkout -b myfeature develop to checkout from origin/develop?

Thanks much!

A:

you update the remote tracking branch with
git fetch origin

Then you update your local develop branch with
git checkout develop
git merge origin/develop

or 
git push . origin/develop:develop # you avoid having to checkout the branch to update it

Then make your feature off of the latest develop with:
git checkout -b myfeature develop

Double check with git log:
git log -1 --decorate

You should see the commit and the fact that develop, orgin/develop, myfeature and HEAD all point to the same thing. You can now work in the new branch and the work will be the latest as of the point in time when you fetched.

