Check local branch before commit (add-and-commit)

If not on branch, check if it's safe to switch to provided branch,
which defaults to "master"
extract 'ensureOnBranch' to git/functions