Git

Unstaged changes
git diff > out.patch

Staged changes
git diff --cached > out.patch

All changes
git diff HEAD > out.patch

Stash only staged changes
git stash -- $(git diff --staged --name-only)

Updated fork with upstream
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git git fetch upstream git pull upstream master

Get the remote branch
git rev-parse --symbolic-full-name --abbrev-ref @{u}