Clone the Remote Repo (Do not create child directory before)
git clone <cloneurl>
Change to the repo
cd <pathtorepo>
Create a local branch linked to each remote branch that exists, and fetch and pull them all just in case
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
View Branches
git branch
git branch -a
Checkout a Branch
git checkout <branchname>
Create a New Branch
git branch <newbranchname>
git checkout <newbranchname>
or
git checkout -b <newbranchname>
Rename a Branch
git branch -m <oldbranchname> <newbranchname>
Delete a Branch
git branch -D <branchname>
Compare Branches
git diff <firstbranchname>..<secondbranchname>
Track a Remote Branch
git branch --set-upstream-to origin/<branchname>
or
git push -u origin <branchname>
Prune Remote Branches
git remote prune origin
Get just 1 branch
git checkout --track origin/<branchname>