forked from x-motemen/ghq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghq.txt
152 lines (116 loc) · 5.34 KB
/
ghq.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
= 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> | <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_ or _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. +
If given a subcommand name e.g. 'ghq import <subcommand> [<args>...]',
ghq looks up a configuration 'ghq.import.<subcommand>' for a command, invokes
it, and uses its output as URLs list. See below for 'ghq.import.<subcommand>'
in CONFIGURATION section.
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.import.<subcommand>::
When 'import' is called with extra arguments e.g. 'ghq import <subcommand> [<args>...]',
first of them is treated as a subcommand name and this configuration value
will be used for a command. The command is invoked with rest arguments
and expected to print remote repository URLs line by line. +
For example with https://github.com/motemen/github-list-starred[github-list-starred]:
....
# Invoke as `ghq import starred motemen`
[ghq "import"]
starred = github-list-starred
....
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
----
go get github.com/motemen/ghq
----
Or clone the https://github.com/motemen/ghq[repository] and run:
----
make install
----
== AUTHOR
motemen <[email protected]>