LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ghq

Manage remote repository clones in a structured directory hierarchy

TLDR

Clone a repository
$ ghq get [https://github.com/owner/repo]
copy
Clone a repository via SSH
$ ghq get -p [owner/repo]
copy
List managed repositories
$ ghq list
copy
List with full paths
$ ghq list -p
copy
Get repository root
$ ghq root
copy
Create new repository
$ ghq create [owner]/[repo]
copy
Remove a local repository
$ ghq rm [owner/repo]
copy
Update an already cloned repository
$ ghq get -u [owner/repo]
copy

SYNOPSIS

ghq command [options] [arguments]

DESCRIPTION

ghq manages remote repository clones in a structured directory hierarchy. It clones repositories into organized paths based on their URLs, enabling consistent repository organization across projects.The tool integrates with shell workflows and fuzzy finders like fzf for quick repository navigation. It supports GitHub, GitLab, Bitbucket, and custom Git hosts.

PARAMETERS

get URL

Clone a repository. Alias: clone.
list [query]
List local repositories, optionally filtered by query.
root
Show repository root path.
create NAME
Create a new repository locally.
rm NAME
Remove a local repository clone.
-p
Clone via SSH (get) or show full paths (list).
-u, --update
Update existing repository (pull --ff-only).
--shallow
Shallow clone (depth 1, Git only).
--branch BRANCH
Clone a specific branch.
--bare
Perform a bare clone (Git only).
--no-recursive
Do not clone git submodules.
-e, --exact
Require exact query match (list).
--dry-run
Show path without deleting (rm).
--vcs VCS
Specify VCS backend: git, svn, hg, darcs, fossil, bzr.
--help
Display help information.

CONFIGURATION

~/.gitconfig

Configure repository root path with `ghq.root` setting, default user with `ghq.user`, and per-URL VCS with `ghq.<url>.vcs`.
GHQ_ROOT
Environment variable to override all ghq.root settings.

CAVEATS

Requires git. Default root is ~/ghq or configurable via ghq.root in gitconfig or GHQ_ROOT env var. URL parsing determines directory structure. Supports multiple VCS backends beyond Git.

HISTORY

ghq was created by motemen as a tool for organizing Git repositories, inspired by go get's directory structure conventions.

SEE ALSO

git(1), fzf(1), gh(1)

Copied to clipboard
Kai