I've seen several ways to delete branches:
git push origin --delete --force rc
git branch -D rc
git branch -dr origin/rc
In a blog I saw a guy do yet another kind of delete:
Delete the old-name remote branch and push the new-name local branch.
git push origin :old-name new-name
Reset the upstream branch for the new-name local branch.
git push origin -u new-name
For the blog example, it looks like he is doing the same thing twice. Didn't he just push new-name to remote? I don't see the need for the second command here.
I've seen a popular way to do it on stackoverflow. I tried the most upvoted answer:
git branch -d branch_name
git push origin --delete <branchName>
I find that I need to run both of these commands (I use -D in place of -d) to reliably delete both local and remote.
I want a reliable way to delete both local and remote branches for a branch named rc. Do I need to run two seperate commands? What is the difference between all these commands?