Organize git repositories by their origin URL
Project description
reposort v2.0.0
Organize git repositories by their origin URL.
Why?
If you work with many git repositories, you've probably inflicted these problems on yourself:
- Scattered repositories: Repos cloned into random directories (
~/workspace,~/stufs,~/tmp/test123) - Hard to find projects: No consistent structure makes it difficult to locate specific repositories
- Duplicate clones: Multiple copies of the same repo in different locations
- Mixed sources: Repos from GitHub, GitLab, BitBucket, and private servers all jumbled together
- Lost context: Directory names don't reflect the organization or team that owns the repo
reposort fixes your shit by automatically organizing all your git repositories
based on their remote origin URL, creating a predictable, hierarchical structure
that mirrors the source hosting:
~/code/
├── aur.archlinux.org/
│ └── weewx/
├── bitbucket.org/
│ ├── bhptechsi/
│ └── ccgmurdoch/
├── github.com/
│ ├── apple/
│ ├── astar-ai/
│ ├── ...
│ ├── sthysel/
│ ├── sthysel-freight/
│ ├── sthyselfreight/
│ ├── sthysel-shop/
│ ├── sthyselzsh/
│ └── windwp/
├── gitlab.com/
│ ├── bhp-cloudfactory/
│ └── vasdee/
├── sdappsgit.bhp.com/
│ ├── iabs/
│ └── mag/
├── sdappsgit.ent.bhpbilliton.net/
│ ├── ddl/
│ ├── hdl/
│ ├── ...
│ ├── scm/
│ ├── toc/
│ └── wts/
└── ssh.dev.azure.com/
└── v3/
This structure makes it easy to:
- Find a repository in context
- Understand where a project comes from at a glance
- Avoid duplicate clones
- Navigate related projects from the same organization
- Script operations across repositories by host or team
Tip: While this organization provides a clean canonical structure, you can maintain a "linkfarm" of symbolic links to frequently used repositories or project groups for quick access:
~/active/
├── current-project -> ~/code/github.com/mycompany/api
├── monitoring -> ~/code/github.com/mycompany/monitoring
└── dotfiles -> ~/code/github.com/me/dotfiles
This gives you both a well-organised source of truth and convenient shortcuts for active work.
Installation
For Users
reposort is in pypi, install as a tool using uv:
# Install globally as a tool
uv tool install reposort
# Or run directly without installation
uvx reposort --dry-run
$ reposort --help
Usage: reposort [OPTIONS]
Organize git repositories by their origin URL.
Examples: reposort --dry-run Show what would be moved without making
changes
reposort Execute the repository reorganization
reposort --source /path/to/repos --target ~/projects Organize repos
from custom source to custom target
Options:
--source DIRECTORY Source directory containing git repositories
--target PATH Target base directory
--dry-run Show what would be done without making changes
--help Show this message and exit.
Using uvx is convenient for one-off runs or trying the tool without installing it. The tool will be downloaded and cached automatically.
For Development
Clone the repository and install in editable mode:
uv sync
This will create a virtual environment, install the package in editable mode, and install all dependencies (including dev dependencies from the lockfile).
Usage
# Dry-run to preview changes
reposort --dry-run
# Execute the reorganization (default: searches current dir, targets ~/code)
reposort
# Custom source and target directories
reposort --source /path/to/repos --target ~/projects
Examples
Transforms repositories like:
git@github.com:user/repo.git→~/code/github.com/user/repossh://git@host:7999/team/project.git→~/code/host/team/projecthttps://github.com/user/repo.git→~/code/github.com/user/repo
Development
Quick Start with just
This project includes a justfile for common development tasks:
# Set up dev environment (install deps + pre-commit hooks)
just setup
# Run type checking
just typecheck
# Run linting
just lint
# Auto-fix linting issues
just fix
# Format code
just format
# Run all checks
just check
# Run pre-commit hooks on all files
just pre-commit
# Clean build artifacts
just clean
# See all available commands
just --list
Manual Commands
Install dependencies:
uv sync
Set up pre-commit hooks:
pre-commit install
Run type checking:
ty check src/reposort
Run formatting and linting:
ruff check src/reposort
ruff format src/reposort
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 reposort-2.0.0.tar.gz.
File metadata
- Download URL: reposort-2.0.0.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bdaed30c6872078641204b3bedf0ef862c1136b54520a9419ac72eef22f50cc
|
|
| MD5 |
0b8bea71d1528c374556114114409176
|
|
| BLAKE2b-256 |
fe015e66512ce4876b1a36391d72584a6fcc77837519ad8a938593d3ec5f2bd6
|
Provenance
The following attestation bundles were made for reposort-2.0.0.tar.gz:
Publisher:
publish.yml on sthysel/reposort
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reposort-2.0.0.tar.gz -
Subject digest:
6bdaed30c6872078641204b3bedf0ef862c1136b54520a9419ac72eef22f50cc - Sigstore transparency entry: 791402773
- Sigstore integration time:
-
Permalink:
sthysel/reposort@cbf392858d18a6c66564a619802de05f6acb50d0 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/sthysel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cbf392858d18a6c66564a619802de05f6acb50d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file reposort-2.0.0-py3-none-any.whl.
File metadata
- Download URL: reposort-2.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 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 |
68709ab75e98aa5cfac59c5c20ecad5a6722913955199759e28f5c5446e7fa3b
|
|
| MD5 |
ad72b4f66113e706ebdc5d1533bbd4a9
|
|
| BLAKE2b-256 |
4cfcc54b72996e7262046b115c33b6f57e8dd328fbe16503e1df369987088d49
|
Provenance
The following attestation bundles were made for reposort-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on sthysel/reposort
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reposort-2.0.0-py3-none-any.whl -
Subject digest:
68709ab75e98aa5cfac59c5c20ecad5a6722913955199759e28f5c5446e7fa3b - Sigstore transparency entry: 791402776
- Sigstore integration time:
-
Permalink:
sthysel/reposort@cbf392858d18a6c66564a619802de05f6acb50d0 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/sthysel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cbf392858d18a6c66564a619802de05f6acb50d0 -
Trigger Event:
push
-
Statement type: