Working with multiple branches
There is a branch on a remote but this branch does not exist locally, and I want it locally:
git fetch $remote_name
git branch $local_branch_name $remote_name/$remote_branch_name
There is a local branch which does not exist on the remote, and I want it on the remote:
git checkout $local_branch_name
git push [-u] $remote_name $remote_branch_name
I have been working on a feature branch, but the main branch has advanced in the meantime. I want to rebase so
that my feature branch has the changes made in the main (remember that rebasing changes the history!):
git checkout $feature_branch
git rebase $main_branch