{"id":13747182,"url":"https://github.com/hartwork/git-delete-merged-branches","last_synced_at":"2025-04-15T02:16:59.190Z","repository":{"id":37027887,"uuid":"281773723","full_name":"hartwork/git-delete-merged-branches","owner":"hartwork","description":":fire: Command-line tool to delete merged Git branches","archived":false,"fork":false,"pushed_at":"2025-04-11T16:40:30.000Z","size":472,"stargazers_count":891,"open_issues_count":4,"forks_count":17,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-15T02:16:51.867Z","etag":null,"topics":["automation","cleanup","cli","cli-tool","command-line","command-line-tool","developer-tool","developer-tools","git","housekeeping","python","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/git-delete-merged-branches/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hartwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-22T20:11:16.000Z","updated_at":"2025-04-11T16:40:35.000Z","dependencies_parsed_at":"2023-12-22T17:28:11.390Z","dependency_job_id":"1099aba7-fa57-4e03-b48b-2c995ca2c3de","html_url":"https://github.com/hartwork/git-delete-merged-branches","commit_stats":{"total_commits":268,"total_committers":7,"mean_commits":"38.285714285714285","dds":"0.23134328358208955","last_synced_commit":"8250e89f305d695ff2765548f168ffc9f897ea6d"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fgit-delete-merged-branches","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fgit-delete-merged-branches/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fgit-delete-merged-branches/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fgit-delete-merged-branches/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hartwork","download_url":"https://codeload.github.com/hartwork/git-delete-merged-branches/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991561,"owners_count":21194894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","cleanup","cli","cli-tool","command-line","command-line-tool","developer-tool","developer-tools","git","housekeeping","python","python3"],"created_at":"2024-08-03T06:01:19.328Z","updated_at":"2025-04-15T02:16:59.162Z","avatar_url":"https://github.com/hartwork.png","language":"Python","funding_links":[],"categories":["Python","automation"],"sub_categories":[],"readme":"[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![Run the test suite](https://github.com/hartwork/git-delete-merged-branches/actions/workflows/run-tests.yml/badge.svg)](https://github.com/hartwork/git-delete-merged-branches/actions/workflows/run-tests.yml)\n[![Packaging status](https://repology.org/badge/tiny-repos/git-delete-merged-branches.svg)](https://repology.org/project/git-delete-merged-branches/versions)\n\n\n# git-delete-merged-branches\n\nA convenient command-line tool helping you keep repositories clean.\n\n\n# Installation\n\n```console\n# pip install git-delete-merged-branches\n```\n\nIf you are using one of the distributions below, you can install\n`git-delete-merged-branches` through the respective package manager, e.g.:\n\n| Distribution | Command |\n| ------------ | ------- |\n| [Arch Linux (AUR)](https://aur.archlinux.org/packages/git-delete-merged-branches/) | `yay -S git-delete-merged-branches` |\n| [Debian GNU/Linux (\u003e=bookworm)](https://packages.debian.org/bookworm/git-delete-merged-branches) | `apt install git-delete-merged-branches` |\n| [Gentoo Linux](https://packages.gentoo.org/packages/dev-vcs/git-delete-merged-branches) | `emerge -av dev-vcs/git-delete-merged-branches` |\n| [Homebrew](https://formulae.brew.sh/formula/git-delete-merged-branches) | `brew install git-delete-merged-branches` |\n| [MacPorts](https://ports.macports.org/port/py-git-delete-merged-branches/details/) | `port install py-git-delete-merged-branches` |\n| [NixOS](https://search.nixos.org/packages?query=git-delete-merged-branches) | `nix-shell -p git-delete-merged-branches` |\n| [Ubuntu (\u003e=lunar/23.04)](https://packages.ubuntu.com/source/lunar/git-delete-merged-branches) | `apt install git-delete-merged-branches` |\n| [Void Linux](https://github.com/void-linux/void-packages/tree/master/srcpkgs/git-delete-merged-branches) | `xbps-install -S git-delete-merged-branches` |\n\n\n# Example\n\n```console\n# git-delete-merged-branches\nDo you want to run \"git remote update --prune\" for 1 remote(s):\n  - origin\n\nUpdate? [y/N] y\n\nDo you want to run \"git pull --ff-only\" for 1 branch(es):\n  - master\n\nPull? [y/N] y\n\nYou are about to delete 6 local branch(es):\n  - improve-setup-py\n  - issue-12-enable-ci-for-pull-requests\n  - issue-5-fix-waste-of-one-second-per-service\n  - keep-github-actions-up-to-date\n  - refactoring-one\n  - simple-ci\n\nDelete? [y/N] y\n\n6 local branch(es) deleted.\nYou are about to delete 6 remote branch(es):\n  - origin/improve-setup-py\n  - origin/issue-12-enable-ci-for-pull-requests\n  - origin/issue-5-fix-waste-of-one-second-per-service\n  - origin/keep-github-actions-up-to-date\n  - origin/refactoring-one\n  - origin/simple-ci\n\nDelete? [y/N] y\nTo github.com:hartwork/wait-for-it.git\n - [deleted]         improve-setup-py\n - [deleted]         issue-12-enable-ci-for-pull-requests\n - [deleted]         issue-5-fix-waste-of-one-second-per-service\n - [deleted]         keep-github-actions-up-to-date\n - [deleted]         refactoring-one\n - [deleted]         simple-ci\n\n6 remote branch(es) deleted.\n```\n\n\n# Features\n\n- Supports deletion of both local and remote branches\n- Detects multiple forms of de-facto merges\n  (rebase merges,\n  squash merges (needs `--effort=3`),\n  single or range cherry-picks…\n  leveraging `git cherry`)\n- Supports workflows with multiple release branches, e.g. only delete branches that have been merged to *all* of `master`, `dev`  and `staging`\n- Quick interactive configuration\n- Provider agnostic: Works with GitHub, GitLab, Gitea and any other Git hosting\n- Takes safety seriously\n\n\n# Safety\n\nDeletion is a sharp knife that requires care.\nWhile `git reflog` would have your back in most cases,\n`git-delete-merged-branches` takes safety seriously.\n\nHere's what `git-delete-merged-branches` does for your safety:\n- No branches are deleted without confirmation or passing `--yes`.\n- Confirmation defaults to \"no\"; plain `[Enter]`/`[Return]` does not delete.\n- `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.\n- There is no use of `os.system` or shell code to go wrong.\n- With `--dry-run` you can get a feel for the changes that `git-delete-merged-branches` would be making to your branches.\n- Show any Git commands run using `--verbose`.\n\n\n# Best Practices\n\nWhen the repository is a fork\n(with an upstream remote and a fork remote):\n\n- Make sure that release branches are tracking the right remote,\n  e.g. `master` should probably track original upstream's `master`\n  rather than `master` of your fork.\n- Consider keeping your fork's remote `master` up to date (using `git push`).\n\nWhen using GitHub:\n\n- You can make GitHub\n  [delete branches of merged pull requests](https://docs.github.com/en/github/administering-a-repository/managing-the-automatic-deletion-of-branches)\n  for you, to save `git-delete-merged-branches` some work on the remote side, if you like.\n\n\n# Name clash on \"git-delete-merged-branches\" with git-extras\n\nUtility collection [git-extras](https://github.com/tj/git-extras) provides a\n[simple shell script named `git-delete-merged-branches`](https://github.com/tj/git-extras/blob/master/bin/git-delete-merged-branches)\nthat competes for command `git-delete-merged-branches` when both software packages are installed.\n\nTo address this conflict you can:\n\n- a) Invoke `python3 -m git_delete_merged_branches` instead of `git-delete-merged-branches`\n- b) Invoke command `git-dmb` instead of `git-delete-merged-branches`\n- c) Control path resolution order through environment variable `$PATH`\n- d) Invoke `git-delete-merged-branches` with its absolute path.\n     You can run `which -a git-delete-merged-branches` to see where it's located.\n\n\n# Support\n\nPlease report any bugs that you find.\n\nLike this tool?  Support it with a star!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhartwork%2Fgit-delete-merged-branches","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhartwork%2Fgit-delete-merged-branches","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhartwork%2Fgit-delete-merged-branches/lists"}