A neat little tool to make cloning of git repos a little more tidy.
Go to file
2019-05-12 20:30:10 +09:00
cmdutil Revert "warn if executable was not found when RunCommand" 2019-05-06 21:58:28 +09:00
gitutil utilize gitutil package in main 2019-05-07 02:25:20 +09:00
logger add TestDoImport 2019-05-05 23:39:46 +09:00
zsh fixup docs and zsh completion 2014-10-06 21:58:36 +09:00
.gitignore introduce Go Modules and godzil, and adjust releng files 2019-04-27 19:54:46 +09:00
.travis.yml introduce Go Modules and godzil, and adjust releng files 2019-04-27 19:54:46 +09:00
CHANGELOG.md Checking in changes prior to tagging of version v0.12.1 2019-05-07 03:33:09 +09:00
commands.go separate getter.go from commands.go 2019-05-06 23:37:24 +09:00
commands_test.go utilize gitutil package in main 2019-05-07 02:25:20 +09:00
CREDITS update CREDITS 2019-05-06 00:27:21 +09:00
getter.go add comment 2019-05-07 03:46:56 +09:00
ghq.txt update README 2019-05-06 00:51:02 +09:00
go.mod update deps 2019-05-07 03:32:05 +09:00
go.sum update deps 2019-05-07 03:32:05 +09:00
go_import.go s/const Version/const version/ 2019-05-01 14:03:32 +09:00
go_import_test.go detect repositry URL from go-import meta tag 2019-04-22 16:42:35 +09:00
helpers_test.go utilize gitutil package in main 2019-05-07 02:25:20 +09:00
import.go separate import.go from commands.go 2019-05-05 23:07:06 +09:00
import_test.go add import_test.go 2019-05-05 23:46:46 +09:00
LICENSE MIT license 2014-06-10 16:31:57 +09:00
list.go adjustment 2019-05-07 01:28:37 +09:00
list_test.go add TestDoList_unknownRoot 2019-05-06 21:44:08 +09:00
local_repository.go utilize gitutil package in main 2019-05-07 02:25:20 +09:00
local_repository_test.go adjust walkLocalRepositories to return error correctly 2019-05-06 21:26:42 +09:00
main.go Checking in changes prior to tagging of version v0.12.1 2019-05-07 03:33:09 +09:00
Makefile adjust Makefile 2019-04-29 23:30:03 +09:00
README.asciidoc ln 2015-07-17 11:14:36 +09:00
remote_repository.go utilize gitutil package in main 2019-05-07 02:25:20 +09:00
remote_repository_test.go adjust test 2019-05-07 01:41:50 +09:00
url.go adjust impl and fix test 2019-05-12 20:30:10 +09:00
url_test.go adjust impl and fix test 2019-05-12 20:30:10 +09:00
vcs.go bzr pull --overwrite same as go get 2019-05-06 02:55:21 +09:00
vcs_test.go utilize newTempDir 2019-05-06 16:20:15 +09:00

= ghq(1) image:https://travis-ci.org/motemen/ghq.svg?branch=master["Build Status", link="https://travis-ci.org/motemen/ghq"]

== 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] (<repository URL> | <host>/<user>/<project> | <user>/<project> | <project>)
'ghq' list [-p] [-e] [<query>]
'ghq' look (<project> | <path/to/project>)
'ghq' import [-u] [-p] < FILE
'ghq' import <subcommand> [<args>...]
'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.

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.

== 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"),
    and "darcs". +
    To get this configuration variable effective, you will need Git 1.8.5 or higher. +
    For example in .gitconfig:

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

ghq.ghe.host::
    The hostname of your GitHub Enterprise installation. A repository that has a
    hostname set with this key will be regarded as same one as one on GitHub.
    This variable can have multiple values. If so, `ghq` tries matching with
    each hostnames. +
    This option is DEPRECATED, so use "ghq.<url>.vcs" configuration instead.

== 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>