Command-line tool to delete merged Git branches
Project description
git-delete-merged-branches
A convenient command-line tool helping you keep repositories clean.
Installation
pip install git-delete-merged-branches
Example
# git-delete-merged-branches
You are about to delete 6 local branch(es):
- improve-setup-py
- issue-12-enable-ci-for-pull-requests
- issue-5-fix-waste-of-one-second-per-service
- keep-github-actions-up-to-date
- refactoring-one
- simple-ci
Delete? [y/N] y
You are about to delete 6 remote branch(es):
- origin/improve-setup-py
- origin/issue-12-enable-ci-for-pull-requests
- origin/issue-5-fix-waste-of-one-second-per-service
- origin/keep-github-actions-up-to-date
- origin/refactoring-one
- origin/simple-ci
Delete? [y/N] y
To github.com:hartwork/wait-for-it.git
- [deleted] improve-setup-py
- [deleted] issue-12-enable-ci-for-pull-requests
- [deleted] issue-5-fix-waste-of-one-second-per-service
- [deleted] keep-github-actions-up-to-date
- [deleted] refactoring-one
- [deleted] simple-ci
Features
- Supports deletion of both local and remote branches
- Supports workflows with multiple release branches, e.g. only delete branches that have been merged to all of
master
,dev
andstaging
- Quick interactive configuration
- Provider agnostic: Works with GitHub, GitLab and any other Git hosting
- Takes safety seriously
Safety
Deletion is a sharp knife that requires care.
While git reflog
would have your back in most cases,
git-delete-merged-branches
takes safety seriously.
Here's what git-delete-merged-branches
does for your safety:
- No branches are deleted without confirmation or passing
--yes
. - Confirmation defaults to "no"; plain
[Enter]
/[Return]
does not delete. git push
is used with--force-with-lease
so if the server and you have a different understanding of that branch, it is not deleted.- There is no use of
os.system
or shell code to go wrong. - With
--dry-run
you can get a feel for the changes thatgit-delete-merged-branches
would be making to your branches. - Show any Git commands run using
--verbose
.
Best Practices
- Consider running
git remote update --prune
before usinggit-delete-merged-branches
for best results. - When the repository is a fork:
- consider keeping your local
master
up to date (by making it a tracking branch or by usinggit pull
). - consider keeping your fork's remote
master
up to date (usinggit push
).
- consider keeping your local
Support
Please report any bugs that you find.
Like this tool? Support it with a star!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for git-delete-merged-branches-1.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc74c3fd9a23df53646dcdcaa015ccb2569daeb4d9567687ef3b369c8e39c724 |
|
MD5 | d02fe27fa268d2f5d0317dbbe0ba0486 |
|
BLAKE2b-256 | 81a9a85ae7726018905d608c382cc4fd2d9beec778e515d1b11824821ab07960 |
Close
Hashes for git_delete_merged_branches-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ea70298dcf1a06b116fd0bb6dfa08a34f4944854dc75a6bf8ab8456f86a51cf |
|
MD5 | 84cd34a69035fe3739c0fbb2791b1899 |
|
BLAKE2b-256 | 4063bc6d1d5d83756c23faeccfe8e2abc7becb476f8b3207292be04d71e26575 |