I’ve been wanting to figure out how to set an existing local branch to track a remote branch for awhile. Here’s how! As well as the command to delete a remote branch.

To set the a branch to track a remote branch:

git branch --set-upstream mybranch remotes/origin/mybranch

To delete a remote branch:

git push origin --delete mybranch