Skip to main content

Organize git repositories by their origin URL

Project description

reposort v1.0.0

Organize git repositories by their origin URL.

Why?

If you work with many git repositories, you've probably had these self-inflicted problems:

  • 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 solves this by automatically organizing all your git repositories based on their remote origin URL, creating a predictable, hierarchical structure that mirrors the source hosting:

~/code/
├── github.com/
│   ├── torvalds/linux
│   └── youruser/yourproject
├── gitlab.com/
│   └── yourteam/backend
└── git.company.com/
    ├── platform/api
    └── platform/frontend

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-organized source of truth and convenient shortcuts for active work.

Installation

For Users

Install as a tool using uv:

# Install globally as a tool
uv tool install reposort

# Or run directly without installation
uvx reposort --dry-run

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/repo
  • ssh://git@host:7999/team/project.git~/code/host/team/project
  • https://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

reposort-1.0.0.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

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

reposort-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file reposort-1.0.0.tar.gz.

File metadata

  • Download URL: reposort-1.0.0.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for reposort-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d0d484f358beeded1a9ce124cb732e3c388c27c918079a7b140440d7d2da54bd
MD5 7a3220b09899265e0c784fbd28cda438
BLAKE2b-256 2a4f98e8cfd6a9ed247d52a82cd5e4831fbbf4f5e04dc8228b7831f2a367ec84

See more details on using hashes here.

Provenance

The following attestation bundles were made for reposort-1.0.0.tar.gz:

Publisher: publish.yml on sthysel/reposort

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

File details

Details for the file reposort-1.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for reposort-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ce7e90acc961cff44d23975973ac8c4dd9e84ee433751f44955e6966f1d6b4
MD5 05466a132a3853564a0fba4b38bf884c
BLAKE2b-256 99afcfa645f6a321e72b1545172beb7c760941fcb592256af7581e838a364e8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for reposort-1.0.0-py3-none-any.whl:

Publisher: publish.yml on sthysel/reposort

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