Git – Remote Branch – Tips

A little memo when I need to start a git project from a remote branch and server:

git init
git remote add origin [server]
git fetch origin
git checkout -b [localbranchname] origin/[remotebranchname]

The 2 last lines are the most important. To view all branches:

git branch -v -a

For bitbucket (my favorite git repo), [server] will be something like

git@bitbucket.org:[login]/[project].git