git-delete-merged-branches


Namegit-delete-merged-branches JSON
Version 7.4.2 PyPI version JSON
download
home_pagehttps://github.com/hartwork/git-delete-merged-branches
SummaryCommand-line tool to delete merged Git branches
upload_time2024-12-22 17:06:01
maintainerNone
docs_urlNone
authorSebastian Pipping
requires_python>=3.9
licenseGPLv3+
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![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)
[![Packaging status](https://repology.org/badge/tiny-repos/git-delete-merged-branches.svg)](https://repology.org/project/git-delete-merged-branches/versions)


# git-delete-merged-branches

A convenient command-line tool helping you keep repositories clean.


# Installation

```console
# pip install git-delete-merged-branches
```

If you are using one of the distributions below, you can install
`git-delete-merged-branches` through the respective package manager, e.g.:

| Distribution | Command |
| ------------ | ------- |
| [Arch Linux (AUR)](https://aur.archlinux.org/packages/git-delete-merged-branches/) | `yay -S git-delete-merged-branches` |
| [Debian GNU/Linux (>=bookworm)](https://packages.debian.org/bookworm/git-delete-merged-branches) | `apt install git-delete-merged-branches` |
| [Gentoo Linux](https://packages.gentoo.org/packages/dev-vcs/git-delete-merged-branches) | `emerge -av dev-vcs/git-delete-merged-branches` |
| [Homebrew](https://formulae.brew.sh/formula/git-delete-merged-branches) | `brew install git-delete-merged-branches` |
| [MacPorts](https://ports.macports.org/port/py-git-delete-merged-branches/details/) | `port install py-git-delete-merged-branches` |
| [NixOS](https://search.nixos.org/packages?query=git-delete-merged-branches) | `nix-shell -p git-delete-merged-branches` |
| [Ubuntu (>=lunar/23.04)](https://packages.ubuntu.com/source/lunar/git-delete-merged-branches) | `apt install git-delete-merged-branches` |
| [Void Linux](https://github.com/void-linux/void-packages/tree/master/srcpkgs/git-delete-merged-branches) | `xbps-install -S git-delete-merged-branches` |


# Example

```console
# 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 branch(es):
  - 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 multiple forms of de-facto merges
  (rebase merges,
  squash merges (needs `--effort=3`),
  single or range cherry-picks…
  leveraging `git cherry`)
- Supports workflows with multiple release branches, e.g. only delete branches that have been merged to *all* of `master`, `dev`  and `staging`
- Quick interactive configuration
- Provider agnostic: Works with GitHub, GitLab, Gitea 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 that `git-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's `master`
  rather than `master` of your fork.
- Consider keeping your fork's remote `master` up to date (using `git push`).

When using GitHub:

- You can make GitHub
  [delete branches of merged pull requests](https://docs.github.com/en/github/administering-a-repository/managing-the-automatic-deletion-of-branches)
  for you, to save `git-delete-merged-branches` some work on the remote side, if you like.


# Name clash on "git-delete-merged-branches" with git-extras

Utility collection [git-extras](https://github.com/tj/git-extras) provides a
[simple shell script named `git-delete-merged-branches`](https://github.com/tj/git-extras/blob/master/bin/git-delete-merged-branches)
that competes for command `git-delete-merged-branches` when both software packages are installed.

To address this conflict you can:

- a) Invoke `python3 -m git_delete_merged_branches` instead of `git-delete-merged-branches`
- b) Invoke command `git-dmb` instead of `git-delete-merged-branches`
- c) Control path resolution order through environment variable `$PATH`
- d) Invoke `git-delete-merged-branches` with its absolute path.
     You can run `which -a git-delete-merged-branches` to see where it's located.


# Support

Please report any bugs that you find.

Like this tool?  Support it with a star!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hartwork/git-delete-merged-branches",
    "name": "git-delete-merged-branches",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Sebastian Pipping",
    "author_email": "sebastian@pipping.org",
    "download_url": "https://files.pythonhosted.org/packages/dc/e5/c76a87598f2c76574e6741abedbda6bd50e709f8b51a3d0a30bb130a8dce/git_delete_merged_branches-7.4.2.tar.gz",
    "platform": null,
    "description": "[![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 (>=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 (>=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\u2026\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",
    "bugtrack_url": null,
    "license": "GPLv3+",
    "summary": "Command-line tool to delete merged Git branches",
    "version": "7.4.2",
    "project_urls": {
        "Homepage": "https://github.com/hartwork/git-delete-merged-branches"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35ddf26a4dbdb5dff63bc6863a8ed44d29ed12a4e9305605e662aa291cec2572",
                "md5": "fc39b53093244ff099ea9304bff6df90",
                "sha256": "23c19924e23ea52b7f613aac99d407d8320b4bafcd4a474ed2891b6d6451e962"
            },
            "downloads": -1,
            "filename": "git_delete_merged_branches-7.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc39b53093244ff099ea9304bff6df90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 44119,
            "upload_time": "2024-12-22T17:05:59",
            "upload_time_iso_8601": "2024-12-22T17:05:59.209465Z",
            "url": "https://files.pythonhosted.org/packages/35/dd/f26a4dbdb5dff63bc6863a8ed44d29ed12a4e9305605e662aa291cec2572/git_delete_merged_branches-7.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dce5c76a87598f2c76574e6741abedbda6bd50e709f8b51a3d0a30bb130a8dce",
                "md5": "c2400d474fb02eee791ca82a0ef0ee5d",
                "sha256": "44a4ae5a83f194f0800e373519fd22c6bb3e6e99b883221f7b666bd36cdac415"
            },
            "downloads": -1,
            "filename": "git_delete_merged_branches-7.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c2400d474fb02eee791ca82a0ef0ee5d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 41632,
            "upload_time": "2024-12-22T17:06:01",
            "upload_time_iso_8601": "2024-12-22T17:06:01.697055Z",
            "url": "https://files.pythonhosted.org/packages/dc/e5/c76a87598f2c76574e6741abedbda6bd50e709f8b51a3d0a30bb130a8dce/git_delete_merged_branches-7.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-22 17:06:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hartwork",
    "github_project": "git-delete-merged-branches",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "git-delete-merged-branches"
}
        
Elapsed time: 0.34923s