VCSH(1)

πŸ’… VCSH(1) β€” the vcsh manual page, bestie edition ✨

okay so you opened the manual page for vcsh, and I'm gonna walk you through it like we're on FaceTime at 1am. it's the General Commands Manual entry, and no cap, it's lowkey iconic. let's go 🫢


✨ NAME ✨

vcsh β€” Version Control System for $HOME β€” multiple Git repositories in $HOME. literally that's the whole vibe. πŸ’–


🌸 SYNOPSIS 🌸

vcsh [options] command

vcsh clone [-b branch] url [repo]

vcsh delete repo

vcsh enter repo

vcsh foreach [-g] git command

vcsh help

vcsh init repo

vcsh list

vcsh list-tracked [repo]

vcsh list-untracked [-a] [-r] [repo]

vcsh pull

vcsh push

vcsh rename repo newname

vcsh run repo shell command

vcsh status [repo]

vcsh upgrade repo

vcsh version

vcsh which substring

vcsh write-gitignore [repo]

vcsh repo gitcommand

vcsh repo

every single one of those is real, I promise. don't skip any. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the whole point: vcsh lets you have several git(1) repositories, and they all keep their working trees in $HOME without clobbering each other. that's the slay. πŸŽ€

which means β€” hear me out β€” you can have one repository per config set (zsh, vim, ssh, etc), and then you just pick and choose which configs you want on which machine. it's giving main character energy for your dotfiles.

the technique under the hood is called fake bare Git repositories β€” it keeps $GIT_DIR in a different directory from $GIT_WORK_TREE, and $GIT_WORK_TREE is pointed to $HOME. ✨

and the best part? no symlinks needed in this setup, so your setup stays cleaner. periodt.

vcsh was designed with mr(1) in mind, so you might wanna install it alongside vcsh. that said, you can easily use vcsh without mr if that's more your vibe β€” no pressure, fr fr.

a sample configuration for vcsh and mr lives at https://github.com/RichiH/vcsh_mr_template and you can use it with:

vcsh clone https://github.com/RichiH/vcsh_mr_template mr
πŸ’‘ one thing to remember: you can always use a path instead of a name for repo. this is needed to support mr and other scripts properly, and it's of no concern to an interactive user β€” so don't stress, bestie. 🫢

πŸ’… OPTIONS πŸ’…

  • -c β€” source file prior to other configuration files
  • -d β€” enable debug mode
  • -v β€” enable verbose mode

short, sweet, iconic. ✨


πŸŽ€ COMMANDS πŸŽ€

  • clone β€” clone an existing repository.

if you need to clone a bundle of repositories, look into the post-clone-retired hook. πŸ‘€

you can also use a single git repository with several branches. use the -b option to specify a branch at clone time; the default is master.

  • commit β€” commit in all repositories.
  • delete β€” delete an existing repository. πŸ—‘οΈ
  • enter β€” enter repository; spawns a new $SHELL with $GIT_DIR set.
  • foreach β€” execute git command for every vcsh repository.
    • -g: execute in general context.
  • help β€” display help. we love a self-aware king.
  • init β€” initialize an empty repository.
  • list β€” list all local vcsh repositories.
  • list-tracked β€” list all files tracked by vcsh.

if you want to list files tracked by a specific repository, simply append the repository's name last. 🫢

  • list-tracked-by β€” list files tracked by a repository.
⚠️ this is a legacy command; you should use list-tracked <repo> instead.
  • list-untracked β€” list all files NOT tracked by vcsh.
    • -a: show all files. by default, git ls-files --exclude-standard is called.
    • -r: recursive mode. by default, the file list is shallow and stops at directory levels where possible.
    • $repo: list files not tracked by this specific repository.
  • pull β€” pull from all vcsh remotes.
  • push β€” push to all vcsh remotes.
  • rename β€” rename a repository.
  • run β€” run command with $GIT_DIR and $GIT_WORK_TREE set. this lets you run any and all commands with no restrictions. use with care, bestie. 😭
πŸ’‘ please note there's a somewhat magic feature for run. instead of repo it also accepts path. anything that has a slash in it will be assumed to be a path. vcsh run will then operate on this directory instead of the one normally generated from the repository's name. this is needed to support mr and other scripts properly, and is of no concern to an interactive user.
  • status β€” show statuses of all/one vcsh repositories.
  • upgrade β€” upgrade repository to currently recommended settings. glow-up time ✨
  • version β€” print version information.
  • which substring β€” find substring in the name of any tracked file. iykyk πŸ”
  • write-gitignore β€” write .gitignore.d/repo via git ls-files. if repo is not specified but we're withing a vcsh repository, use that. (yes, "withing" β€” we keep the original's typo energy, it's part of the lore 🫢)
  • repo gitcommand β€” shortcut to run git commands on a repo. will prepend git to gitcommand.
  • repo β€” shortcut to run vcsh enter <repo>.

🌈 ENVIRONMENT 🌈

as noted earlier, vcsh will set $GIT_DIR and $GIT_WORK_TREE to the appropriate values for fake bare Git repositories. that's the whole trick, and it ate. πŸ’…


🧚 CONFIG 🧚

there are several ways to turn the various knobs on vcsh. in order of ascending precedence, they are:

  1. VARIABLE=foo vcsh
  2. /etc/vcsh/config
  3. $XDG_CONFIG_HOME/vcsh/config
  4. vcsh -c file
⚠️ please note those files are sourced, i.e. executed. any and all commands will be executed in the context of your shell. so like, be normal about what you put in there. πŸ™ˆ

πŸ’– interesting knobs you can turn

  • $VCSH_GITATTRIBUTES β€” can be none, or any other value.
    • none will not maintain Git attributes in a special location.
    • if set to any other value, repo-specific gitattributes files will be maintained.
    • defaults to none.
  • $VCSH_GITIGNORE β€” can be exact, none, or recursive.
    • exact will seed the repo-specific ignore file with all file and directory names which git ls-files returns.
    • none will not write any ignore file.
    • recursive will descend through all directories recursively, additionally to the above.
    • defaults to exact.
  • $VCSH_WORKTREE β€” can be absolute, or relative.
    • absolute will set an absolute path, defaulting to $HOME.
    • relative will set a path relative to $GIT_DIR.
    • defaults to absolute.

🌸 less interesting knobs you could turn

  • $VCSH_DEBUG β€” enter debug mode.
  • $XDG_CONFIG_HOME β€” as specified in the 'XDG Base Directory Specification', see http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html. defaults to $HOME/.config.
  • $VCSH_REPO_D β€” the directory where repositories are read from and stored. defaults to $XDG_CONFIG_HOME/vcsh/repo.d.
  • $VCSH_HOOK_D β€” the directory where hooks are read from. defaults to $XDG_CONFIG_HOME/vcsh/hooks-enabled.
  • $VCSH_BASE β€” the directory where repositories are checked out to. defaults to $HOME.

⭐ HOOK SYSTEM ⭐

vcsh provides a hook system, and honestly? obsessed. hook scripts must be executable and should be placed in $XDG_CONFIG_HOME/vcsh/hooks-available. from there, they can be soft-linked into $XDG_CONFIG_HOME/vcsh/hooks-enabled; vcsh will only execute hooks that are in this directory. πŸ”₯

hooks follow a simple format. pre-run will be run before anything is run. if you want more than one script for a certain hook, just append any kind of string to order them. a system of pre-run, pre-run.10, pre-run.20 etc is suggested; other options would be pre-run-10 or pre-run.sh. a dot after the hook name is optional. πŸŽ€

if you want to create hooks for a specific vcsh repository, simply prepend the repository's name, followed by a dot, i.e. zsh.pre-run. otherwise, the same rules as above apply. the dot between the repository's name and the hook is mandatory, though. no skipping it.

available hooks are: pre-clone, post-clone, post-clone-retired, pre-command, post-command, pre-enter, post-enter, pre-init, post-init, pre-pull, post-pull, pre-push, post-push, pre-run, post-run, pre-upgrade, and post-upgrade. if you need more, vcsh is trivial to patch, but please let upstream know so they can ship them by default. 🫢


πŸ’œ OVERLAY SYSTEM πŸ’œ

vcsh also provides an overlay system. similar to hooks, the recommended locations are $XDG_CONFIG_HOME/vcsh/overlays-available and $XDG_CONFIG_HOME/vcsh/overlays-enabled.

overlays follow the same rules as hooks, and you are free to overwrite any and all functions. same as hooks, you can use global or repository-specific overlays by using either $VCSH_OVERLAY_D/$VCSH_COMMAND or $VCSH_OVERLAY_D/$VCSH_REPO_NAME.$VCSH_COMMAND.

⚠️ DANGER, BESTIE ⚠️ please note that nothing stops you from, e.g. overwriting status() in $VCSH_OVERLAY_D/commit. as the overlays will be sourced and you are replacing arbitrary functions, any and all features may stop working, or you may even lose data.

you have been warned. πŸ˜­πŸ’€


πŸ”₯ DETAILED HOWTO AND FURTHER READING πŸ”₯

manpages are often short and sometimes useless to glean best practices from. while the author tried to avoid this in this case, manpages can not cover detailed howtos. (they said it, not me.)

this software also comes with a file called README.md. it contains various approaches to setting up and using vcsh. you can view the file as plain text, or render it into various other formats via Markdown. ✨

on Debian-based systems, this file can be found in /usr/share/doc/vcsh.


πŸ’€ SECURITY CONSIDERATIONS πŸ’€

vcsh allows you to execute arbitrary commands via vcsh run. for example, adding a sudo(8) rule for vcsh would be pretty stupid. like, genuinely. don't. πŸ™ˆ

additionally, vcsh will source β€” i.e. execute β€” all files listed in CONFIG. you can put any and all commands into these config files and they will be executed. that's not a bug, that's the design, but also, be careful.


πŸ“ BUGS πŸ“

none are known at this time, but reports and/or patches are more than welcome. 🫢


🌈 INTEROPERABILITY 🌈

if you rely on git submodule, use git 1.7.12 or later. earlier versions do not clean internal variables properly before descending into submodules, resulting in unhappy end users. and we do not want unhappy end users. 😭


πŸ‘‘ HISTORY πŸ‘‘

like most people, the author initially made do with a single repository for all config files, all of which were soft-linked into $HOME. relatable.

Martin F. Krafft aka madduck came up with the concept of fake bare Git repositories. king behavior.

vcsh was initially written by madduck. this version is a re-implementation from scratch with a lot more features. madduck graciously agreed to let the author take over the name. πŸŽ€


πŸ’… AUTHOR πŸ’…

this manpage and vcsh itself were written by Richard "RichiH" Hartmann. we stan. ⭐


Copyright 2011-2015 Richard Hartmann richih@debian.org

Licensed under the GNU GPL version 2 or higher.

https://github.com/RichiH/vcsh


🌟 SEE ALSO 🌟

git(1), mr(1)


aaand that's the page! πŸ’– cute sign-off time: this was the vcsh page dated April 2024, straight from the vcsh project itself β€” so if you're reading a stale copy, go check upstream. mwah. πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from