Script to clean up your local Git checkout by removing local branches whose changes have been integrated into the main development branch.
When this script is run it will:
- Determine the main development branch
- Remove any branches which have been explicitly merged into the main branch
- Check for local branches which would produce no changes if merged into the main branch, and offer to remove them
- Check for local branches which track remote branches that have been removed, and offer to remove them
This script requires Python 3.8 or later.
- Clone this repository
cd
into the target Git repository that you want to clean up- Check out the main development branch in the target repo and run
git pull
to ensure it is up to date with the remote side (eg. on GitHub) - Run the
prune-merged-branches.py
script from this repository