Category CoDe:U Git Flow Cookbook  
By:  Lars Kruse  
On: Friday, October 03. 2014

Clean out local ready branches

Your local clone will potentially have ready/* branches hanging around that probably might already be integrated and deleted both on origin and on the clone at the Jenkins slave.

You want to clean out these branches.

The problem in a nut shell

The branches comes from the process where you deliver:

git push origin my-dev:ready/my-dev

As you deliver ready branches from your local clone using this approach ready/* branches will be created to trace the corresponding branch on origin. But up there they’ll just be deleted as soon as integrated.

How to do it

The key here is to prune local branches when synchronizing with origin. Pruning is available as a switch -p or --prune on the fetch command.

So simply run the following command to clean up:

git fetch origin --prune