{"id":19107729,"url":"https://github.com/dominikbraun/cleanup","last_synced_at":"2025-04-30T18:49:40.177Z","repository":{"id":45924238,"uuid":"234958337","full_name":"dominikbraun/cleanup","owner":"dominikbraun","description":"Remove gone Git branches with ease.","archived":false,"fork":false,"pushed_at":"2021-11-27T23:07:58.000Z","size":84,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T18:49:31.066Z","etag":null,"topics":["cleanup","cli-tool","collaboration","developer-productivity","developer-tools","git","git-branches","git-branching","git-cli","git-tools","git-utils","repository-management","repository-tools","repository-utilities"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dominikbraun.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}},"created_at":"2020-01-19T20:07:24.000Z","updated_at":"2025-04-21T13:45:53.000Z","dependencies_parsed_at":"2022-09-26T18:51:00.228Z","dependency_job_id":null,"html_url":"https://github.com/dominikbraun/cleanup","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominikbraun%2Fcleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominikbraun%2Fcleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominikbraun%2Fcleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominikbraun%2Fcleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dominikbraun","download_url":"https://codeload.github.com/dominikbraun/cleanup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251765634,"owners_count":21640216,"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":["cleanup","cli-tool","collaboration","developer-productivity","developer-tools","git","git-branches","git-branching","git-cli","git-tools","git-utils","repository-management","repository-tools","repository-utilities"],"created_at":"2024-11-09T04:13:40.890Z","updated_at":"2025-04-30T18:49:40.129Z","avatar_url":"https://github.com/dominikbraun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cimg src=\"https://sternentstehung.de/cleanup.png\"\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003ecleanup \u0026ndash; Remove gone Git branches with ease.\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://circleci.com/gh/dominikbraun/cleanup\"\u003e\u003cimg src=\"https://circleci.com/gh/dominikbraun/cleanup.svg?style=shield\"\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/dominikbraun/cleanup\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/dominikbraun/cleanup\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.codefactor.io/repository/github/dominikbraun/cleanup\"\u003e\u003cimg src=\"https://www.codefactor.io/repository/github/dominikbraun/cleanup/badge\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/dominikbraun/cleanup/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/dominikbraun/cleanup?sort=semver\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/dominikbraun/cleanup/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache--2.0-brightgreen\"\u003e\u003c/a\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003c/p\u003e\n\n---\n\n:dizzy: cleanup is a CLI tool for keeping your Git repositories clean. It removes old branches in one or more repositories with a single command.\n\n**Project status:** In active development. Can be used without warranty.\n\n## \u003cimg src=\"https://sternentstehung.de/cleanup-dot.png\"\u003e Quick example\n\nYou merely need to provide the path to your repository. For example, change into your project directory and remove all gone branches like this:\n\n````shell script\n$ cleanup branches .\n````\n\nIf you want to get a preview of branches that will be deleted, just perform a dry run.\n\n````shell script\n$ cleanup branches --dry-run .\n````\n\nThere appear some branches that probably shouldn't be deleted? You can simply exclude them:\n\n````shell script\n$ cleanup branches --exclude=\"feature/3, feature/4\" .\n````\n\n**Deleting branches that match a custom search term**\n\n`--where` allows you to specify a string that has to be included in a branch's `git branch -vv` output. This option\noverrides the default filter for gone branches, _meaning that also non-gone branches will be deleted_. \n\nFor example, deleting _all_ feature branches is as simple as:\n\n```shell script\n$ cleanup branches --where=\"feature/\" .\n```\n\nIn case you want to delete _only gone feature branches_, extend the default filter for gone branches with `--and-where`.\n\n```shell script\n$ cleanup branches --and-where=\"feature/\" .\n```\n\n**Cleaning multiple repositories at once**\n\nMost developers work on multiple projects at once. Let's assume that these projects have a common parent directory.\n\n\u003cimg src=\"https://sternentstehung.de/example-projects.png\"\u003e\n\nDeleting gone branches in all of these repositories is fairly simple:\n\n````shell script\n$ cleanup branches --has-multiple-repos projects\n````\n\n## \u003cimg src=\"https://sternentstehung.de/cleanup-dot.png\"\u003e What cleanup does\n\nTo find out which branches are gone on the remote, cleanup uses the output of `git branch -vv`.\n\n````shell script\n$ git branch -vv\n* master\t34a234a [origin/master] Merged some features\n  feature/1\t34a234a [origin/feature/1: gone] Implemented endpoints\n  feature/2\t3fc2e37 [origin/feature/2: gone] Added CLI flags\n````\n\nBased on that output, cleanup performs `git branch -d \u003cbranch\u003e` on all gone branches. Maybe you've been doing the same\nthing manually for each branch in each repository. However, the `--where` flag allows you to specify a custom string\nthat has to be included to delete the branch.\n\n## \u003cimg src=\"https://sternentstehung.de/cleanup-dot.png\"\u003e Installation\n\nDownload the [latest release of cleanup](https://github.com/dominikbraun/cleanup/releases).\n\n**Linux/macOS**\n\nCopy the downloaded binary into a directory like `/usr/local/bin`. Make sure the directory is listed in `PATH`.\n\n**Windows**\n\nCreate a directory like `C:\\Program Files\\cleanup` and copy the executable into it. [Add the directory](https://www.computerhope.com/issues/ch000549.htm) to `Path`.\n\n## \u003cimg src=\"https://sternentstehung.de/cleanup-dot.png\"\u003e Remove branches periodically\n\nEspecially developers working in larger teams may want to clean up their repositories periodically.\n\n**Linux/macOS**\n\nEdit cron's job table.\n\n````shell script\n$ crontab -e\n````\n\nAdding a line like this will run cleanup every day at 11 PM for _all_ repositories. Make sure you provide correct paths to the cleanup binary and project directory.\n\n````shell script\n0 23 * * * /usr/local/bin/cleanup branches --has-multiple-repos /home/user/projects\n````\n\n**Windows**\n\nJust create a scheduled task like this \u0026ndash; and make sure to provide correct paths for the cleanup executable and project directory.\n\n````shell script\n\u003e SCHTASKS /CREATE /SC DAILY /ST 23:00 /TN \"Clean up repositories\" ^\n  /TR \"C:\\Path\\To\\cleanup.exe branches --has-multiple-repos C:\\Path\\To\\Projects\"\n````\n\n\u003cp align=\"center\"\u003e\n\u003cbr\u003e\n\u003cstrong\u003eクリーン\u003c/strong\u003e\n\u003cbr\u003e\n\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominikbraun%2Fcleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdominikbraun%2Fcleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominikbraun%2Fcleanup/lists"}