Initialising a new repo with a different initial branch
After working on some new code, I realised I wanted to push it to an existing remote git repo, but in a branch that didn't exist. The code hadn't been pulled from anywhere - it was newly written in a directory.
Initialise the directory with the branch that you want it to become, commit the code, add the existing remote and push:
git init --initial-branch=my-fun-feature
git add -A && git commit -m "WIP"