I found this two commands very handy to keep your local and remote repositories clean from unused branches. Here are the steps that usually I use to keep my repositories clean:
- First to check branches that exist in your local repository use the following command
$ git branch
- After you see the list of your branches choose one you want to delete as seen bellow
$ git branch -d <your-branch-name>
- To check branches that exist in your remote repository use this command
$ git branch -r
- And the to delete your remote branch use the following command
$ git push origin :<your-branch-name>
If you find this post useful, please leave a comment. :)