git prune to remove the unwanted branches from the local or the remote server. git prune removes the references of the branches we do not use anymore. Usually, there are 3 kinds of branches that we need to clean up.
- The local branches in which we do our day to day working.
- The reference to the remote branches which we use for naming branches
- The branches on the remote server
git branch -D branch_nameTo clean up the reference objects, run the command of the following syntax
git remote prune reference_nameTo delete the unwanted remote branches, run the command
git push origin --delete branch-nameGit prune comes in handy when it comes to keeping the repository neat and clean. Cleaning up the unwanted branches keeps the repository neat.]]>