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
Do you want to run "git remote update --prune" for 1 remote(s):
- origin
Update? [y/N] y
Do you want to run "git pull --ff-only" for 1 branches(s):
- master
Pull? [y/N] y
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
6 local branch(es) deleted.
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
6 remote branch(es) deleted.
Features
- Supports deletion of both local and remote branches
- Detects certain forms of de-facto merges
(certain no-squash rebase merges as well as
certain single or range cherry-picks,
as recognized by
git cherry
) - 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
When the repository is a fork (with an upstream remote and a fork remote):
- Make sure that release branches are tracking the right remote,
e.g.
master
should probably track original upstream'smaster
rather thanmaster
of your fork. - Consider keeping your fork's remote
master
up to date (usinggit push
).
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-4.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41a7b2674b06760e02c57f6c8a2ea812ed50ea2864ff419755962f73671fcb57 |
|
MD5 | 5114ae0dd1e0c3b4b3caef921982a0a8 |
|
BLAKE2b-256 | fcff8d292a1c60a007c6ed516e55117df1c976055101003762803b60235e5406 |
Close
Hashes for git_delete_merged_branches-4.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efbea07e746fae7b2fd9f2e86e9f817ce0efba9aad4b5f7a0c6356a8314d7352 |
|
MD5 | 1a3f852bc042cf66e67ff22f61247298 |
|
BLAKE2b-256 | 23198b29fc47364c07d46485453c55628bc58dfd3b034df824fb9bace26bca67 |