When I first wrote my post on sharing branches, there was something I did not talk about. Namely, how to remove a branch once you're done sharing. (I'll confess I didn't write about it, because at the moment I had not found a way of doing it properly)
But now, thanks to this nice stackflow post, I now know how to do it.
First of all, there are two different scenarios. The first case is when the collaborator you were sharing with, no longer needs their copy of your branch. They might want to remove the branch to tidy up their local repo. This can be done with the following command:
git branch -d <branch>
or to follow in the steps of my old example:
git branch -d superCoolFeature
The lower case -d option will only remove the branch if the branch has not been merged or somehow saved. You can force the removal with the upper case -D option if you're feeling more forceful.
The second case is when you are done using and sharing your branch. You probably have concluded whatever you were trying to do with this branch and merged the result back into master. At this point you might want to remove the temporary branch not only locally, but remotely as well. That can be done with:
git push origin --delete <branchName>
or again, in the case of my example:
git push origin --delete superCoolFeature
And the branch should now be gone from the remote repo. To remove it from the local repo, do the same "branch -d" step as your collaborator did in the first case. Needless to say, please make sure you only erase a branch you were done with.