]> git.madduck.net Git - code/vcsh.git/blob - doc/vcsh.1.ronn

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

correct spelling mistakes
[code/vcsh.git] / doc / vcsh.1.ronn
1 vcsh(1) - Version Control System for $HOME - multiple Git repositories in $HOME
2 ===============================================================================
3
4 ## SYNOPSIS
5
6 `vcsh` [<options>] <command>
7
8 `vcsh` clone [-b <branch>] <url> [<repo>]
9
10 `vcsh` delete <repo>
11
12 `vcsh` enter <repo>
13
14 `vcsh` foreach [-g] <git command>
15
16 `vcsh` help
17
18 `vcsh` init <repo>
19
20 `vcsh` list
21
22 `vcsh` list-tracked [<repo>]
23
24 `vcsh` list-untracked [<-a>] [<-r>] [<repo>]
25
26 `vcsh` pull
27
28 `vcsh` push
29
30 `vcsh` rename <repo> <newname>
31
32 `vcsh` run <repo> <shell command>
33
34 `vcsh` status [<repo>]
35
36 `vcsh` upgrade <repo>
37
38 `vcsh` version
39
40 `vcsh` which <substring>
41
42 `vcsh` write-gitignore <repo>
43
44 `vcsh` <repo> <gitcommand>
45
46 `vcsh` <repo>
47
48
49 ## DESCRIPTION
50
51 `vcsh` allows you to have several `git`(1) repositories, all maintaining their
52 working trees in $HOME without clobbering each other. That, in turn, means you
53 can have one repository per config set (zsh, vim, ssh, etc), picking and
54 choosing which configs you want to use on which machine.
55
56 `vcsh` is using a technique called fake bare Git repositories, keeping <$GIT_DIR>
57 in a different directory from <$GIT_WORK_TREE> which is pointed to <$HOME>.
58
59 The use of symlinks is not needed in this setup, making for a cleaner setup.
60
61 `vcsh` was designed with `mr`(1) in mind so you might want to install it alongside
62 vcsh. That being said, you can easily use `vcsh` without `mr` if you prefer.
63
64 A sample configuration for `vcsh` and `mr` can be found at
65 *https://github.com/RichiH/vcsh_mr_template* and used with `vcsh clone
66 https://github.com/RichiH/vcsh_mr_template mr`.
67
68 Please note that you can always use a path instead of a name for <repo>.
69 This is needed to support mr and other scripts properly and of no concern to
70 an interactive user.
71
72 ## OPTIONS
73
74 * -c:
75   Source <file> prior to other configuration files
76
77 * -d:
78   Enable debug mode
79
80 * -v:
81   Enable verbose mode
82
83 ## COMMANDS
84
85 * clone:
86   Clone an existing repository.
87
88   If you need to clone a bundle of repositories, look into the
89   `post-clone-retired` hook.
90
91   You can also use a single git repository with several branches. Use the `-b`
92   option to specify a branch at clone time, the default is `master`.
93
94 * commit:
95   Commit in all repositories
96
97 * delete:
98   Delete an existing repository.
99
100 * enter:
101   Enter repository; spawn new <$SHELL> with <$GIT_DIR> set.
102
103 * foreach:
104   Execute git command for every vcsh repository.
105
106   `-g`: Execute in general context.
107
108 * help:
109   Display help.
110
111 * init:
112   Initialize an empty repository.
113
114 * list:
115   List all local vcsh repositories.
116
117 * list-tracked:
118   List all files tracked by vcsh.
119
120   If you want to list files tracked by a specific repository, simply
121   append the repository's name last.
122
123 * list-tracked-by:
124   List files tracked by a repository.
125
126   This is a legacy command; you should use `list-tracked <repo>` instead.
127
128 * list-untracked:
129   List all files NOT tracked by vcsh.
130
131   `-a`: Show all files.
132   By default, the `git ls-files --exclude-standard` is called.
133
134   `-r`: Recursive mode.
135   By default, the file list is shallow and stops at directory levels where
136   possible.
137
138   `$repo`: List files not tracked by this specific repository.
139
140 * pull:
141   Pull from all vcsh remotes.
142
143 * push:
144   Push to all vcsh remotes.
145
146 * rename:
147   Rename a repository.
148
149 * run:
150   Run command with <$GIT_DIR> and <$GIT_WORK_TREE> set. Allows you to run any
151   and all commands without any restrictions. Use with care.
152
153   Please note that there is a somewhat magic feature for run. Instead of <repo>
154   it accepts <path>, as well. Anything that has a slash in it will be assumed to
155   be a path. `vcsh run` will then operate on this directory instead of the one
156   normally generated from the repository's name.
157   This is needed to support mr and other scripts properly and of no concern to
158   an interactive user.
159
160 * status:
161   Show statuses of all/one vcsh repositories.
162
163 * upgrade:
164   Upgrade repository to currently recommended settings.
165
166 * version:
167   Print version information.
168
169 * which <substring>:
170   Find <substring> in name of any tracked file.
171
172 * write-gitignore:
173   Write .gitignore.d/<repo> via `git ls-files`.
174
175 * <repo> <gitcommand>:
176   Shortcut to run `git` commands on a repo. Will prepend `git` to <gitcommand>.
177
178 * <repo>:
179   Shortcut to run `vcsh enter <repo>`.
180
181 ## ENVIRONMENT
182
183 As noted earlier, `vcsh` will set <$GIT_DIR> and <$GIT_WORK_TREE> to the
184 appropriate values for fake bare Git repositories.
185
186 ## CONFIG
187
188 There are several ways to turn the various knobs on `vcsh`. In order of
189 ascending precedence, they are:
190
191 * `VARIABLE=foo vcsh`
192 * </etc/vcsh/config>
193 * <$XDG_CONFIG_HOME/vcsh/config>
194 * `vcsh -c <file>`
195
196 Please note that those files are sourced. Any and all commands will be
197 executed in the context of your shell.
198
199 Interesting knobs you can turn:
200
201 * <$VCSH_GITATTRIBUTES>:
202   Can be <none>, or any other value.
203
204   <none> will not maintain Git attributes in a special location.
205
206   If set to any other value, repo-specific gitattributes files will be maintained.
207
208   Defaults to <none>.
209
210 * <$VCSH_GITIGNORE>:
211   Can be <exact>, <none>, or <recursive>.
212
213   <exact> will seed the repo-specific ignore file with all file and directory
214   names which `git ls-files` returns.
215
216   <none> will not write any ignore file.
217
218   <recursive> will descend through all directories recursively additionally to
219   the above.
220
221   Defaults to <exact>.
222
223 * <$VCSH_VCSH_WORKTREE>:
224   Can be <absolute>, or <relative>.
225
226   <absolute> will set an absolute path; defaulting to <$HOME>.
227
228   <relative> will set a path relative to <$GIT_DIR>.
229
230   Defaults to <absolute>.
231
232 Less interesting knobs you could turn:
233
234 * <$VCSH_DEBUG>:
235   Enter debug mode.
236
237 * <$XDG_CONFIG_HOME>:
238   As specified in the 'XDG Base Directory Specification', see
239   <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>
240
241   Defaults to <$HOME/.config>.
242
243 * <$VCSH_REPO_D>:
244   The directory where repositories are read from and stored.
245
246   Defaults to <$XDG_CONFIG_HOME/vcsh/repo.d>.
247
248 * <$VCSH_HOOK_D>:
249   The directory where hooks are read from.
250
251   Defaults to <$XDG_CONFIG_HOME/vcsh/hooks-enabled>.
252
253 * <$VCSH_BASE>:
254   The directory where repositories are checked out to.
255
256   Defaults to <$HOME>.
257
258
259 ## HOOK SYSTEM
260
261 `vcsh` provides a hook system. Hook scripts must be executable and should be
262 placed in <$XDG_CONFIG_HOME/vcsh/hooks-available>. From there, they can be
263 soft-linked into <$XDG_CONFIG_HOME/vcsh/hooks-enabled>; `vcsh` will only
264 execute hooks that are in this directory.
265
266 Hooks follow a simple format. <pre-run> will be run before anything is run.
267 If you want to have more than one script for a certain hook, just append
268 any kind of string to order them. A system of <pre-run>, <pre-run.10>,
269 <pre-run.20> etc is suggested; other options would be <pre-run-10> or
270 <pre-run.sh>. A dot after the hook name is optional.
271
272 If you want to create hooks for a specific <vcsh> repository, simply prepend
273 the repository's name, followed by a dot, i.e. <zsh.pre-run>. Otherwise, the
274 same rules as above apply. The dot between the repository's name and the hook
275 is mandatory, though.
276
277 Available hooks are <pre-clone>, <post-clone>, <post-clone-retired>,
278 <pre-command>, <post-command>, <pre-enter>, <post-enter>, <pre-init>,
279 <post-init>, <pre-pull>, <post-pull>, <pre-push>, <post-push>, <pre-run>,
280 <post-run>, <pre-upgrade>, and <post-upgrade>.
281 If you need more, vcsh is trivial to patch, but please let upstream know so
282 we can ship them by default.
283
284 ## OVERLAY SYSTEM
285
286 `vcsh` also provides an overlay system. Similar to hooks, the recommended
287 locations are <$XDG_CONFIG_HOME/vcsh/overlays-available> and
288 <$XDG_CONFIG_HOME/vcsh/overlays-enabled>.
289
290 Overlays follow the same rules as hooks and you are free to overwrite any
291 and all functions. Same as hooks, you can use global or repository-specific
292 overlays by using either <$VCSH_OVERLAY_D/$VCSH_COMMAND> or
293 <$VCSH_OVERLAY_D/$VCSH_REPO_NAME.$VCSH_COMMAND>.
294
295 Please note that nothing stops you from, e.g. overwriting `status()` in
296 <$VCSH_OVERLAY_D/commit>. As the overlays will be sourced and you are
297 replacing arbitrary functions, any and all features may stop working, or you
298 may even lose data.
299
300 You have been warned.
301
302 ## DETAILED HOWTO AND FURTHER READING
303
304 Manpages are often short and sometimes useless to glean best practices from.
305 While the author tried to avoid this in this case, manpages can not cover
306 detailed howtos.
307
308 This software also comes with a file called <README.md>. It contains various
309 approaches to setting up and using vcsh. You can view the file it as
310 plain text or render it into various other formats via Markdown.
311
312 On Debian-based systems, this file can be found in </usr/share/doc/vcsh>.
313
314 ## SECURITY CONSIDERATIONS
315
316 `vcsh` allows you to execute arbitrary commands via `vcsh run`. For example,
317 adding a `sudo`(8) rule for `vcsh` would be pretty stupid.
318
319 Additionally, vcsh will source, i.e. execute, all files listed in <CONFIG>.
320 You can put any and all commands into these config files and they will be
321 executed.
322
323 ## BUGS
324
325 None are known at this time, but reports and/or patches are more than welcome.
326
327 ## INTEROPERABILITY
328
329 If you rely on `git submodule` use `git` 1.7.12 or later. Earlier versions
330 do not clean internal variables properly before descending into submodules,
331 resulting in unhappy end users.
332
333 ## HISTORY
334
335 Like most people, the author initially made do with a single repository for all
336 config files, all of which were soft-linked into <$HOME>.
337
338 Martin F. Krafft aka madduck came up with the concept of fake bare Git
339 repositories.
340
341 vcsh was initially written by madduck. This version is a re-implementation from
342 scratch with a lot more features. madduck graciously agreed to let the author
343 take over the name.
344
345 ## AUTHOR
346
347 This manpage and `vcsh` itself were written by Richard "RichiH" Hartmann.
348
349 ## COPYRIGHT
350
351 Copyright 2011-2015 Richard Hartmann <richih@debian.org>
352
353 Licensed under the GNU GPL version 2 or higher.
354
355 https://github.com/RichiH/vcsh
356
357 ## SEE ALSO
358
359 `git`(1), `mr`(1)