1VCSH(1)                                                                VCSH(1)
2
3
4

NAME

6       vcsh  - Version Control System for $HOME - multiple Git repositories in
7       $HOME
8

SYNOPSIS

10       vcsh [options] command
11
12       vcsh clone [-b branch] url [repo]
13
14       vcsh delete repo
15
16       vcsh enter repo
17
18       vcsh foreach [-g] git command
19
20       vcsh help
21
22       vcsh init repo
23
24       vcsh list
25
26       vcsh list-tracked [repo]
27
28       vcsh list-untracked [-a] [-r] [repo]
29
30       vcsh pull
31
32       vcsh push
33
34       vcsh rename repo newname
35
36       vcsh run repo shell command
37
38       vcsh status [repo]
39
40       vcsh upgrade repo
41
42       vcsh version
43
44       vcsh which substring
45
46       vcsh write-gitignore [repo]
47
48       vcsh repo gitcommand
49
50       vcsh repo
51

DESCRIPTION

53       vcsh allows you to have several git(1)  repositories,  all  maintaining
54       their  working  trees  in $HOME without clobbering each other. That, in
55       turn, means you can have one repository per config set (zsh, vim,  ssh,
56       etc),  picking  and choosing which configs you want to use on which ma‐
57       chine.
58
59       vcsh is using a technique called fake bare  Git  repositories,  keeping
60       $GIT_DIR  in a different directory from $GIT_WORK_TREE which is pointed
61       to $HOME.
62
63       The use of symlinks is not needed in this setup, making for  a  cleaner
64       setup.
65
66       vcsh  was  designed  with mr(1) in mind so you might want to install it
67       alongside vcsh. That being said, you can easily use vcsh without mr  if
68       you prefer.
69
70       A   sample   configuration   for   vcsh   and   mr   can  be  found  at
71       https://github.com/RichiH/vcsh_mr_template and  used  with  vcsh  clone
72       https://github.com/RichiH/vcsh_mr_template mr.
73
74       Please  note that you can always use a path instead of a name for repo.
75       This is needed to support mr and other scripts properly and of no  con‐
76       cern to an interactive user.
77

OPTIONS

79       -c     Source file prior to other configuration files
80
81       -d     Enable debug mode
82
83       -v     Enable verbose mode
84

COMMANDS

86       clone  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.
92              Use the -b option to specify a branch at clone time, the default
93              is master.
94
95       commit Commit in all repositories
96
97       delete Delete an existing repository.
98
99       enter  Enter repository; spawn new $SHELL with $GIT_DIR set.
100
101       foreach
102              Execute git command for every vcsh repository.
103
104              -g: Execute in general context.
105
106       help   Display help.
107
108       init   Initialize an empty repository.
109
110       list   List all local vcsh repositories.
111
112       list-tracked
113              List all files tracked by vcsh.
114
115              If you want to list files tracked by a specific repository, sim‐
116              ply append the repository´s name last.
117
118       list-tracked-by
119              List files tracked by a repository.
120
121              This is a legacy command; you should use list-tracked <repo> in‐
122              stead.
123
124       list-untracked
125              List all files NOT tracked by vcsh.
126
127              -a: Show all files. By default, the git ls-files --exclude-stan‐
128              dard is called.
129
130              -r:  Recursive  mode.  By  default, the file list is shallow and
131              stops at directory levels where possible.
132
133              $repo: List files not tracked by this specific repository.
134
135       pull   Pull from all vcsh remotes.
136
137       push   Push to all vcsh remotes.
138
139       rename Rename a repository.
140
141       run    Run command with $GIT_DIR and $GIT_WORK_TREE set. Allows you  to
142              run  any  and  all  commands  without any restrictions. Use with
143              care.
144
145              Please note that there is a somewhat magic feature for run.  In‐
146              stead  of  repo  it  accepts  path, as well. Anything that has a
147              slash in it will be assumed to be a path. vcsh run will then op‐
148              erate  on  this  directory instead of the one normally generated
149              from the repository´s name. This is needed  to  support  mr  and
150              other scripts properly and of no concern to an interactive user.
151
152       status Show statuses of all/one vcsh repositories.
153
154       upgrade
155              Upgrade repository to currently recommended settings.
156
157       version
158              Print version information.
159
160       which substring
161              Find substring in name of any tracked file.
162
163       write-gitignore
164              Write  .gitignore.d/repo via git ls-files. If repo is not speci‐
165              fied but we´re withing a vcsh repository, use that.
166
167       repo gitcommand
168              Shortcut to run git commands on a repo. Will prepend git to git‐
169              command.
170
171       repo   Shortcut to run vcsh enter <repo>.
172

ENVIRONMENT

174       As  noted earlier, vcsh will set $GIT_DIR and $GIT_WORK_TREE to the ap‐
175       propriate values for fake bare Git repositories.
176

CONFIG

178       There are several ways to turn the various knobs on vcsh. In  order  of
179       ascending precedence, they are:
180
181VARIABLE=foo vcsh
182
183
184
185
186       ○   <$XDG_CONFIG_HOME/vcsh/config>
187
188vcsh -c <file>
189
190
191
192       Please  note that those files are sourced. Any and all commands will be
193       executed in the context of your shell.
194
195       Interesting knobs you can turn:
196
197       $VCSH_GITATTRIBUTES
198              Can be none, or any other value.
199
200              none will not maintain Git attributes in a special location.
201
202              If set to any other  value,  repo-specific  gitattributes  files
203              will be maintained.
204
205              Defaults to none.
206
207       $VCSH_GITIGNORE
208              Can be exact, none, or recursive.
209
210              exact  will seed the repo-specific ignore file with all file and
211              directory names which git ls-files returns.
212
213              none will not write any ignore file.
214
215              recursive will descend through all directories recursively addi‐
216              tionally to the above.
217
218              Defaults to exact.
219
220       $VCSH_WORKTREE
221              Can be absolute, or relative.
222
223              absolute will set an absolute path; defaulting to $HOME.
224
225              relative will set a path relative to $GIT_DIR.
226
227              Defaults to absolute.
228
229       Less interesting knobs you could turn:
230
231       $VCSH_DEBUG
232              Enter debug mode.
233
234       $XDG_CONFIG_HOME
235              As  specified  in  the  ´XDG  Base Directory Specification´, see
236              http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
237
238              Defaults to <$HOME/.config>.
239
240       $VCSH_REPO_D
241              The directory where repositories are read from and stored.
242
243              Defaults to <$XDG_CONFIG_HOME/vcsh/repo.d>.
244
245       $VCSH_HOOK_D
246              The directory where hooks are read from.
247
248              Defaults to <$XDG_CONFIG_HOME/vcsh/hooks-enabled>.
249
250       $VCSH_BASE
251              The directory where repositories are checked out to.
252
253              Defaults to $HOME.
254

HOOK SYSTEM

256       vcsh provides a hook system. Hook scripts must be executable and should
257       be placed in <$XDG_CONFIG_HOME/vcsh/hooks-available>. From there,  they
258       can  be  soft-linked  into  <$XDG_CONFIG_HOME/vcsh/hooks-enabled>; vcsh
259       will only execute hooks that are in this directory.
260
261       Hooks follow a simple format. pre-run will be run  before  anything  is
262       run.  If you want to have more than one script for a certain hook, just
263       append any  kind  of  string  to  order  them.  A  system  of  pre-run,
264       <pre-run.10>,  <pre-run.20>  etc  is  suggested; other options would be
265       pre-run-10 or <pre-run.sh>. A dot after the hook name is optional.
266
267       If you want to create hooks for  a  specific  vcsh  repository,  simply
268       prepend  the  repository´s name, followed by a dot, i.e. <zsh.pre-run>.
269       Otherwise, the same rules as above apply. The dot between  the  reposi‐
270       tory´s name and the hook is mandatory, though.
271
272       Available hooks are pre-clone, post-clone, post-clone-retired, pre-com‐
273       mand,  post-command,  pre-enter,   post-enter,   pre-init,   post-init,
274       pre-pull,  post-pull,  pre-push,  post-push, pre-run, post-run, pre-up‐
275       grade, and post-upgrade. If you need more, vcsh is  trivial  to  patch,
276       but please let upstream know so we can ship them by default.
277

OVERLAY SYSTEM

279       vcsh also provides an overlay system. Similar to hooks, the recommended
280       locations are <$XDG_CONFIG_HOME/vcsh/overlays-available> and <$XDG_CON‐
281       FIG_HOME/vcsh/overlays-enabled>.
282
283       Overlays  follow  the same rules as hooks and you are free to overwrite
284       any and all functions. Same as hooks, you can  use  global  or  reposi‐
285       tory-specific  overlays by using either <$VCSH_OVERLAY_D/$VCSH_COMMAND>
286       or <$VCSH_OVERLAY_D/$VCSH_REPO_NAME.$VCSH_COMMAND>.
287
288       Please note that nothing stops you from, e.g. overwriting  status()  in
289       <$VCSH_OVERLAY_D/commit>.  As  the overlays will be sourced and you are
290       replacing arbitrary functions, any and all features may  stop  working,
291       or you may even lose data.
292
293       You have been warned.
294

DETAILED HOWTO AND FURTHER READING

296       Manpages  are often short and sometimes useless to glean best practices
297       from. While the author tried to avoid this in this case,  manpages  can
298       not cover detailed howtos.
299
300       This  software  also  comes with a file called <README.md>. It contains
301       various approaches to setting up and using vcsh. You can view the  file
302       it as plain text or render it into various other formats via Markdown.
303
304       On Debian-based systems, this file can be found in .
305

SECURITY CONSIDERATIONS

307       vcsh  allows  you to execute arbitrary commands via vcsh run. For exam‐
308       ple, adding a sudo(8) rule for vcsh would be pretty stupid.
309
310       Additionally, vcsh will source, i.e. execute, all files listed in  CON‐
311       FIG.  You can put any and all commands into these config files and they
312       will be executed.
313

BUGS

315       None are known at this time, but reports and/or patches are  more  than
316       welcome.
317

INTEROPERABILITY

319       If  you rely on git submodule use git 1.7.12 or later. Earlier versions
320       do not clean internal variables properly before descending into submod‐
321       ules, resulting in unhappy end users.
322

HISTORY

324       Like most people, the author initially made do with a single repository
325       for all config files, all of which were soft-linked into $HOME.
326
327       Martin F. Krafft aka madduck came up with the concept of fake bare  Git
328       repositories.
329
330       vcsh was initially written by madduck. This version is a re-implementa‐
331       tion from scratch with a lot more features. madduck  graciously  agreed
332       to let the author take over the name.
333

AUTHOR

335       This manpage and vcsh itself were written by Richard "RichiH" Hartmann.
336
338       Copyright 2011-2015 Richard Hartmann mailto:richih@debian.org
339
340       Licensed under the GNU GPL version 2 or higher.
341
342       https://github.com/RichiH/vcsh
343

SEE ALSO

345       git(1), mr(1)
346
347
348
349                                 October 2021                          VCSH(1)
Impressum