# x-motemen/ghq

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/x-motemen-ghq).**

3,489 stars · 196 forks · Go · mit

## Links

- GitHub: https://github.com/x-motemen/ghq
- awesome-repositories: https://awesome-repositories.com/repository/x-motemen-ghq.md

## Description

ghq is a command line tool and repository manager designed to automate the cloning, organization, and lifecycle management of remote version control repositories. It functions as a wrapper for cloning that maps remote repository URLs to a consistent, structured local directory hierarchy.

The tool differentiates itself by implementing deterministic URL-to-path mapping and a VCS-agnostic cloning pipeline. It supports shallow copies, recursive submodule fetching, and the ability to resolve repository locations from various hosts and version control systems.

Its broader capabilities cover repository discovery through local indexing and filtering, maintenance via automated updates, and migration tools that identify linked worktrees. It also provides utilities for URL normalization and the safe removal of managed repositories from the filesystem.

## Tags

### Development Tools & Productivity

- [Deterministic Path Mapping](https://awesome-repositories.com/f/development-tools-productivity/deterministic-path-mapping.md) — Translates remote repository URLs into deterministic local filesystem paths for consistent project organization.
- [Repository Cloning Tools](https://awesome-repositories.com/f/development-tools-productivity/repository-cloning-tools.md) — Provides automated cloning of remote repositories with support for shallow copies and recursive submodules. ([source](https://github.com/x-motemen/ghq/blob/master/commands_test.go))
- [Local Repository Initializers](https://awesome-repositories.com/f/development-tools-productivity/git-repository-integrators/git-repository-integrators/local-repository-initializers.md) — Creates new repositories within a designated managed directory structure to start projects locally. ([source](https://github.com/x-motemen/ghq#readme))
- [Git Repository Managers](https://awesome-repositories.com/f/development-tools-productivity/git-repository-managers.md) — Manages the cloning, organization, and local storage of multiple Git repositories in a structured hierarchy.
- [Local Repository Updaters](https://awesome-repositories.com/f/development-tools-productivity/local-repository-updaters.md) — Refreshes existing local clones with the latest changes from their remote source repositories. ([source](https://github.com/x-motemen/ghq/blob/master/commands_test.go))
- [Repository Path Mapping](https://awesome-repositories.com/f/development-tools-productivity/path-mapping-configurations/path-mapping-configurations/repository-path-mapping.md) — Assigns remote repository URLs to specific local directory paths to ensure consistent project placement. ([source](https://github.com/x-motemen/ghq/blob/master/local_repository.go))
- [Cross-VCS Cloning](https://awesome-repositories.com/f/development-tools-productivity/repository-cloning-tools/cross-vcs-cloning.md) — Fetches source code from multiple version control systems by parsing the remote repository URL. ([source](https://github.com/x-motemen/ghq/blob/master/remote_repository_test.go))
- [Shallow Cloning](https://awesome-repositories.com/f/development-tools-productivity/repository-cloning-tools/isolated-repository-cloning/history-size-optimization/shallow-cloning.md) — Implements shallow cloning and partial clones to minimize disk and network overhead.
- [Multi-Repository Cloning](https://awesome-repositories.com/f/development-tools-productivity/repository-cloning-tools/multi-repository-cloning.md) — Organizes the cloning of multiple remote repositories into a consistent and structured local workspace. ([source](https://github.com/x-motemen/ghq/blob/master/main.go))
- [Repository Lifecycle Management](https://awesome-repositories.com/f/development-tools-productivity/repository-lifecycle-management.md) — Manages the full lifecycle of local clones, including initialization, updates, migration, and deletion.
- [VCS-Agnostic Cloning Interfaces](https://awesome-repositories.com/f/development-tools-productivity/vcs-agnostic-cloning-interfaces.md) — Abstracts multiple version control systems and hosts into a common interface for fetching source code.
- [Local Repository Organization](https://awesome-repositories.com/f/development-tools-productivity/version-control-systems/local-repository-organization.md) — Downloads source code from various version control systems and arranges them into predictable local filesystem paths.
- [Repository Name Searches](https://awesome-repositories.com/f/development-tools-productivity/git-repository-integrators/ai-optimized-git-repository-ingestors/git-repository-interaction/repository-name-searches.md) — Provides the ability to search and locate cloned projects on the local machine by name or URL.
- [Local Repository Listings](https://awesome-repositories.com/f/development-tools-productivity/git-repository-integrators/ai-optimized-git-repository-ingestors/git-repository-interaction/repository-name-searches/local-repository-listings.md) — Displays cloned repositories with options to filter by name and show full filesystem paths. ([source](https://github.com/x-motemen/ghq#readme))
- [Hosting Provider API Integrations](https://awesome-repositories.com/f/development-tools-productivity/hosting-provider-api-integrations.md) — Integrates with various remote hosting providers and version control backends to fetch source code. ([source](https://github.com/x-motemen/ghq/blob/master/remote_repository.go))
- [Managed Repository Deletions](https://awesome-repositories.com/f/development-tools-productivity/managed-repository-deletions.md) — Deletes local repositories and their associated linked worktrees from the file system. ([source](https://github.com/x-motemen/ghq/blob/master/cmd_rm.go))
- [Meta-Tag Repository Discovery](https://awesome-repositories.com/f/development-tools-productivity/repository-cloning-tools/tag-aware-repository-cloning/meta-tag-repository-discovery.md) — Extracts version control system data from HTML meta tags to resolve import paths to actual remote repositories.
- [Repository Root Detection](https://awesome-repositories.com/f/development-tools-productivity/repository-root-detection.md) — Identifies and displays the local filesystem paths where managed repositories are stored. ([source](https://github.com/x-motemen/ghq/blob/master/cmd_root.go))
- [Source Code Mirroring](https://awesome-repositories.com/f/development-tools-productivity/source-code-mirroring.md) — Enables downloading and managing large collections of remote repositories for offline reference.
- [VCS Repository Detectors](https://awesome-repositories.com/f/development-tools-productivity/vcs-repository-detectors.md) — Identifies the version control system and extracts the remote repository URL from provided input strings. ([source](https://github.com/x-motemen/ghq/blob/master/go_import_test.go))
- [Managed Repository Filters](https://awesome-repositories.com/f/development-tools-productivity/version-control-repository-tools/repository-view-filters/managed-repository-filters.md) — Retrieves lists of cloned repositories using query filters and case-sensitivity toggles. ([source](https://github.com/x-motemen/ghq/blob/master/cmd_list_test.go))
- [Submodule and Worktree Management](https://awesome-repositories.com/f/development-tools-productivity/version-control-repository-tools/version-control-managers/git-utilities/submodule-and-worktree-management.md) — Analyzes linked Git worktrees and submodules to ensure safe repository migration without breaking references.
- [Managed Repository Migrations](https://awesome-repositories.com/f/development-tools-productivity/version-control-repository-tools/version-control-managers/git-utilities/submodule-and-worktree-management/managed-repository-migrations.md) — Moves local repositories into a managed directory structure while updating linked worktrees and submodules. ([source](https://github.com/x-motemen/ghq#readme))

### DevOps & Infrastructure

- [Git Wrappers](https://awesome-repositories.com/f/devops-infrastructure/git-command-execution/git-wrappers.md) — Functions as a wrapper that extends standard git clone with automated path resolution and shallow copies.

### Software Engineering & Architecture

- [Directory-Based Organization](https://awesome-repositories.com/f/software-engineering-architecture/directory-based-organization.md) — Arranges downloaded repositories into a consistent, structured directory hierarchy for local management. ([source](https://github.com/x-motemen/ghq#readme))
- [Project Organization](https://awesome-repositories.com/f/software-engineering-architecture/project-management-governance/repository-maintenance/project-organization.md) — Structures repositories into a consistent directory hierarchy based on remote URLs to improve navigation.
- [Project Root Resolution](https://awesome-repositories.com/f/software-engineering-architecture/file-based-project-storage/project-root-resolution.md) — Provides configurable logic to determine the local project root using environment variables and configuration files.
- [Source Root Configurators](https://awesome-repositories.com/f/software-engineering-architecture/source-file-organization/source-root-configurators.md) — Defines base storage directories for managed repositories via environment variables and configuration files. ([source](https://github.com/x-motemen/ghq/blob/master/cmd_root_test.go))

### Networking & Communication

- [URL Normalizers](https://awesome-repositories.com/f/networking-communication/network-addressing/url-normalizers.md) — Converts various address formats and shorthand notations into standard SSH or HTTPS URLs. ([source](https://github.com/x-motemen/ghq/blob/master/url_test.go))
