Delete unused local branches that are not on the remote

When you are work­ing in teams, branch­ing is a very com­mon way of adding fea­tures and resolv­ing bugs. Merg­ing branches to a remote usu­ally requires devs to send in a pull request so that it can be reviewed.

In the mean­while, if you do a git fetch, you will get that new fea­ture branch on your local. If that branch is merged at the remote and then deleted, you still retain a local copy of that branch although you might never use it.

To remove all of such braches that are not on the remote any­more, but are only present on your local, you run the command

git remote prune

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *