Lopper is a tool that deletes local Git branches that have been merged into the main remote branch.
Lopper will,
- Check if there are any uncommitted changes.
- Checks out the main branch.
- The main branch is updated (pulled)
- Lopper retrieves the list of local branches that have been merged commit and squashed merged into the main branch.
- Lopper deletes the local branches.
See the Usage
section for more details on modifying the behaviour of Lopper.
Install by running commands
brew tap piszmog/tools
brew install piszmog/tools/lopper
Head over to Releases and download the artifact for your architecture.
# Download the latest 64-bit version for Linux
gh release download -R Piszmog/lopper -p '*linux_x86_64*'
# Download the latest 64-bit Intel version for macOS
gh release download -R Piszmog/lopper -p '*macos_x86_64*'
# Download the latest Silicon for macOS
gh release download -R Piszmog/lopper -p '*macos_arm64*'
# Download the latest 64-bit version for Windows
gh release download -R Piszmog/lopper -p '*windows_x86_64*'
# Untar the artifact
tar -xf lopper_0.1.0_linux_x86_64.tar.gz
# Delete the artifact
rm lopper_0.1.0_linux_x86_64.tar.gz
# Move the binary to a directory on your PATH
mv lopper /some/directory/that/is/in/your/path
$ ./lopper -p /path/to/repo/or/directory/of/repos
Option | Default | Required | Description |
---|---|---|---|
--path , -p |
N/A | True | The path to the repository or directory of repositories |
--protected-branch |
N/A | False | The branches other than main and master to protect from deletion (e.g. --protected-branch dev --protected-pranch prod ) |
--concurrency , -c |
1 |
False | The number of repositories to process in parallel |
--dry-run |
false |
False | Run lopper without actually deleting any branches |
--help , -h |
false |
False | Shows help |
Command | Description |
---|---|
help , h |
Shows a list of commands or help for one command |