Working with git branches

I can’t seem to remember the specicfic magic git switches when pushing and pulling branches between different git repositories, so I am writing it down here.

1. Create your local branch for development

git checkout -b my-branch

2. Push local branch to remote server & track it.

git push -u origin my-branch

3. Checkout and track a remote branch

git fetch
git checkout -b my-branch origin/my-branch

Alternatively:

git pull
git checkout -b my-branch origin/my-branch