Skip to main content

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, auto
Default: 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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_unneeded-1.0.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file git_unneeded-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: git_unneeded-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for git_unneeded-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ebae1ee7d63696fc49d3e1acd5399bd4bb021245e54e2144e62a578fa03d10ea
MD5 8fb07e57c6cc92a1ce25f2acc0fb8198
BLAKE2b-256 904a52e393796f23df5768370a60a27c31e158682916cdddb362ed8dac9536d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_unneeded-1.0.5-py3-none-any.whl:

Publisher: publish.yaml on ellieayla/git-unneeded

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page