Determine whether we don't need this clone (or some of its branches) anymore.
Project description
git unneeded
Did you clone a large amount of git repos? Is ~/workspace/ a giant mess? Need to declutter?
If a remote exists and all branches have been pushed (or merged), and you trust the remote git host to stay up, maybe we don't need to keep the local copy. If a branch has been pushed/merged, we don't need to keep them.
But if there's local branch refs for commits that have never been pushed, maybe they should be pushed first. Or at least reviewed.
git unneeded will report whether deleting branches/repo would be safe, or whether there's stuff that needs attention. Doesn't delete anything for you. Can be happily run with a giant shell glob or from xargs.
Install
With uv: uv tool install git-unneeded
With pipx: pipx install git-unneeded
Usage
git unneeded -h
usage: git_unneeded.py [-h] [--color {never,always,auto}] [--debug] [--quiet]
[--oneline] [--skip-unknown-directories] [--no-fetch]
[--no-search-parent]
[directory ...]
| Options | Values | Help |
|---|---|---|
| positional arguments | ||
directory |
Default: . |
GIT_DIR. Default current directory. |
| options | ||
-h --help |
Flag. | show this help message and exit |
--color |
Choice: never, always, autoDefault: auto |
|
--debug |
Flag. | Exact git commands and decisions. |
--quiet -q -s |
Flag. | Just safe/not, no justification. |
--oneline |
Flag. | Just output directory\0True. Implies --quiet. |
--skip-unknown-directories |
Flag. | If a passed directory isn't a git repo, skip it. Not considered a failure. |
--no-fetch |
Flag. | Don't connect to any configured remotes. Local cache might be old. |
--no-search-parent |
Flag. | Don't search up parent directories for .git. |
So for the annoying case of too many repos;
$ find ~/workspace -maxdepth 2 -name .git -type d -print0 | xargs -0 git unneeded --no-fetch
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_unneeded-1.0.3-py3-none-any.whl.
File metadata
- Download URL: git_unneeded-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
303a000de4bf45c23090f3ca0b66204e20a1c71e3999fc8dec53a2186b504c35
|
|
| MD5 |
c0ddbfc289f8476a5572109bdd4d02bd
|
|
| BLAKE2b-256 |
42824ed96352ae42b3dc1cef122d0f7a0a10fa6587961c815137c045b812fec1
|
Provenance
The following attestation bundles were made for git_unneeded-1.0.3-py3-none-any.whl:
Publisher:
publish.yaml on ellieayla/git-unneeded
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_unneeded-1.0.3-py3-none-any.whl -
Subject digest:
303a000de4bf45c23090f3ca0b66204e20a1c71e3999fc8dec53a2186b504c35 - Sigstore transparency entry: 1114595162
- Sigstore integration time:
-
Permalink:
ellieayla/git-unneeded@83a1e23026042ad43023c32a33a23bce2604fc83 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/ellieayla
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@83a1e23026042ad43023c32a33a23bce2604fc83 -
Trigger Event:
push
-
Statement type: