GIT – remove unused branches

If you have some branche son your remote repository that are no longer in use you can delete them by following the steps below (make sure no one is updating these branches anymore).

First list the remote branches defined in your local repository

git branch -r

Now delete the branch with name Refactored (casesensitive) from origin (remote)

git push origin --deleted Refactored

Now to update the branches for a repository at another location (deleting stale branches) execute the command:

git fetch origin --prune

The local branches will be synced with the remote branches

Share

Leave a Reply

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