Delete unused local branches that are not on the remote

When you are working in teams, branching is a very common way of adding features and resolving bugs. Merging branches to a remote usually requires devs to send in a pull request so that it can be reviewed.

In the meanwhile, if you do a git fetch, you will get that new feature 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 anymore, but are only present on your local, you run the command

git remote prune

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...

Leave a Reply

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