A neat little tool to make cloning of git repos a little more tidy.
Go to file
2019-12-26 16:36:28 +09:00
.github/workflows fix broken coverage report 2019-12-12 03:48:17 +09:00
cmdutil refine create subcommand 2019-12-24 11:53:05 +09:00
logger add TestDoImport 2019-05-05 23:39:46 +09:00
misc Add bash-completion 2019-12-24 15:25:03 +09:00
.gitignore Ignore ghq.exe 2019-12-04 22:18:17 +09:00
CHANGELOG.md Checking in changes prior to tagging of version v0.17.2 2019-12-26 16:36:28 +09:00
cmd_create.go update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
cmd_create_test.go trivial fix 2019-12-25 00:09:18 +09:00
cmd_get.go update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
cmd_get_test.go fix test 2019-12-25 23:37:20 +09:00
cmd_import.go update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
cmd_import_test.go The parallel option is now an official feature 2019-12-25 23:51:46 +09:00
cmd_list.go update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
cmd_list_test.go define envGhqRoot 2019-12-26 00:58:38 +09:00
cmd_look.go update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
cmd_look_test.go adjust file structure 2019-12-18 23:50:35 +09:00
cmd_root.go update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
cmd_root_test.go define envGhqRoot 2019-12-26 00:58:38 +09:00
commands.go The parallel option is now an official feature 2019-12-25 23:51:46 +09:00
commands_test.go detect repositry root by using get-urlmatch 2019-12-23 02:35:30 +09:00
CREDITS update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
getter.go refactor getter.go 2019-12-24 12:19:30 +09:00
getter_test.go refine local cloning path detection. fix #180 2019-05-28 15:44:39 +09:00
go.mod update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
go.sum update urfave/cli deps to v2 2019-12-25 23:26:37 +09:00
go_import.go Fix typos 2019-12-04 19:59:53 +09:00
go_import_test.go skip go-import mod 2019-05-12 15:14:56 +09:00
helpers_test.go refactor test helpers 2019-12-19 02:21:20 +09:00
helpers_unix.go refactor test helpers 2019-12-19 02:21:20 +09:00
helpers_windows.go refactor test helpers 2019-12-19 02:21:20 +09:00
LICENSE MIT license 2014-06-10 16:31:57 +09:00
local_repository.go add comment 2019-12-26 01:13:50 +09:00
local_repository_test.go define envGhqRoot 2019-12-26 00:58:38 +09:00
main.go Checking in changes prior to tagging of version v0.17.2 2019-12-26 16:36:28 +09:00
Makefile stop providing 32bit binary 2019-12-25 23:58:38 +09:00
README.adoc adjust document 2019-12-26 00:22:10 +09:00
remote_repository.go refine create subcommand 2019-12-24 11:53:05 +09:00
remote_repository_test.go adjust test 2019-05-07 01:41:50 +09:00
url.go fix interface of newURL 2019-12-24 02:06:43 +09:00
url_test.go fix interface of newURL 2019-12-24 02:06:43 +09:00
vcs.go refine create subcommand 2019-12-24 11:53:05 +09:00
vcs_test.go add --recursive option to ghq get 2019-12-20 18:48:33 +09:00

= ghq(1) image:https://github.com/motemen/ghq/workflows/test/badge.svg?branch=master["Build Status", link="https://github.com/motemen/ghq/actions?workflow=test"] image:https://coveralls.io/repos/motemen/ghq/badge.svg?branch=master["Coverage", link="https://coveralls.io/r/motemen/ghq?branch=master"]

== NAME

ghq - Manage remote repository clones

== DESCRIPTION

'ghq' provides a way to organize remote repository clones, like +go get+ does. When you clone a remote repository by +ghq get+, ghq makes a directory under a specific root directory (by default +~/.ghq+) using the remote repository URL's host and path.

    $ ghq get https://github.com/motemen/ghq
    # Runs `git clone https://github.com/motemen/ghq ~/.ghq/github.com/motemen/ghq`

You can also list local repositories (+ghq list+), jump into local repositories (+ghq look+), and bulk get repositories by list of URLs (+ghq import+).

== SYNOPSIS

[verse]
ghq get [-u] [-p] [--shallow] [--vcs] [--look] [--silent] [--branch] [--no-recursive] (<repository URL> | <host>/<user>/<project> | <user>/<project> | <project>)
ghq list [-p] [-e] [<query>]
ghq look (<project> | <path/to/project> | <host>/<user>/<project> | <repository URL>)
ghq import [-u] [-p] [--shalow] [--vcs] [--silent] [--no-recursive] [--parallel] < FILE
ghq root [--all]

== COMMANDS

get::
    Clone a remote repository under ghq root directory (see
    <<directory-structures,DIRECTORY STRUCTURES>> below). If the repository is
    already cloned to local, nothing will happen unless '-u' ('--update')
    flag is supplied, in which case the local repository is updated ('git pull --ff-only' eg.).
    When you use '-p' option, the repository is cloned via SSH protocol. +
    If there are multiple +ghq.root+ s, existing local clones are searched
    first. Then a new repository clone is created under the primary root if
    none is found. +
    With '--shallow' option, a "shallow clone" will be performed (for Git
    repositories only, 'git clone --depth 1 ...' eg.). Be careful that a
    shallow-cloned repository cannot be pushed to remote.
    Currently Git and Mercurial repositories are supported. +
    With '--branch' option, you can clone the repository with specified
    repository. This option is currently supported for Git, Mercurial,
    Subversion and git-svn. +
    The 'ghq' gets the git repository recursively by default. +
    We can prevent it with '--no-recursive' option.

list::
    List locally cloned repositories. If a query argument is given, only
    repositories whose names contain that query text are listed. '-e'
    ('--exact') forces the match to be an exact one (i.e. the query equals to
    _project_, _user_/_project_ or _host_/_user_/_project_)
    If '-p' ('--full-path') is given, the full paths to the repository root are
    printed instead of relative ones.

look::
    Look into a locally cloned repository with the shell.

import::
    If no extra arguments given, reads repository URLs from stdin line by line
    and performs 'get' for each of them.

root::
    Prints repositories' root (i.e. `ghq.root`). Without '--all' option, the
    primary one is shown.

create::
    Creates new repository.

== CONFIGURATION

Configuration uses 'git-config' variables.

ghq.root::
    The path to directory under which cloned repositories are placed. See
    <<directory-structures,DIRECTORY STRUCTURES>> below. Defaults to +~/.ghq+. +
    This variable can have multiple values. If so, the first one becomes
    primary one i.e. new repository clones are always created under it. You may
    want to specify "$GOPATH/src" as a secondary root (environment variables
    should be expanded.)

ghq.<url>.vcs::
    ghq tries to detect the remote repository's VCS backend for non-"github.com"
    repositories.  With this option you can explicitly specify the VCS for the
    remote repository. The URL is matched against '<url>' using 'git config --get-urlmatch'. +
    Accepted values are "git", "github" (an alias for "git"), "subversion",
    "svn" (an alias for "subversion"), "git-svn", "mercurial", "hg" (an alias for "mercurial"),
    "darcs", "fossil", "bazaar", and "bzr" (an alias for "bazaar"). +
    To get this configuration variable effective, you will need Git 1.8.5 or higher. +
    For example in .gitconfig:

ghq.<url>.root::
    The "ghq" tries to detect the remote repository-specific root directory. With this option,
    you can specify a repository-specific root directory instead of the common ghq root directory. +
    The URL is matched against '<url>' using 'git config --get-urlmatch'.

....
[ghq "https://git.example.com/repos/"]
vcs = git
root = ~/myproj
....

== ENVIRONMENT VARIABLES

GHQ_ROOT::
    If set to a path, this value is used as the only root directory regardless
    of other existing ghq.root settings.

== [[directory-structures]]DIRECTORY STRUCTURES

Local repositories are placed under 'ghq.root' with named github.com/_user_/_repo_.

....
~/.ghq
|-- code.google.com/
|   `-- p/
|       `-- vim/
`-- github.com/
    |-- google/
    |   `-- go-github/
    |-- motemen/
    |   `-- ghq/
    `-- urfave/
        `-- cli/
....


== [[installing]]INSTALLATION

=== homebrew

----
brew install ghq
----

=== go get

----
go get github.com/motemen/ghq
----

=== build

----
git clone https://github.com/motemen/ghq .
make install
----

Built binaries are available from GitHub Releases.
https://github.com/motemen/ghq/releases

== AUTHOR

motemen <motemen@gmail.com>