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.
1 vcsh - manage and sync config files via git
5 vcsh allows you to have several git repositories, all maintaining their working
6 trees in $HOME without clobbering each other. That, in turn, means you can have
7 one repository per config set (zsh, vim, ssh, etc), picking and choosing which
8 configs you want to use on which machine.
10 vcsh was designed with mr [1] in mind so you might want to install that, as
13 Read INSTALL.md for detailed setup instructions.
15 Questions? RichiH@{Freenode,OFTC,IRCnet}
17 ## Comparison to Other Solutions ##
19 Most people who decide to put their dotfiles under version control start with a
20 **single repository in $HOME**, adding all their dotfiles (and possibly more)
21 to it. This works, of course, but can become a nuisance as soon as you try to
22 manage more than one host.
24 The next logical step is to create single-purpose repositories in, for example,
25 ~/.dotfiles and to create **symbolic links in $HOME**. This gives you the
26 flexibility to check out only certain repositories on different hosts. The
27 downsides of this approach are the necessary manual steps of cloning and
28 symlinking the individual repositories. It will probably become a nuisance when
29 you try to manage more than two hosts.
31 **vcsh** takes this second approach one step further. It expects
32 **single-purpose repositories** and stores them in a hidden directory (similar
33 to ~/.dotfiles). However, it does not create symbolic links in $HOME; it puts
34 the **actual files right into $HOME**.
36 Furthermore, by making use of mr [1], it makes it very easy to enable/disable
37 and clone a large number of repositories. The use of mr is technically
38 optional, but it will be an integral part of the proposed system that follows.
40 ## Default Directory Layout ##
42 To illustrate, this is what a possible directory structure looks like.
49 | | | |-- gitconfigs.vcsh
51 | | | |-- offlineimap.vcsh
55 | | | |-- vimperator.vcsh
56 | | | `-- snippets.git
58 | | |-- zsh.mrconfig -> ../available.d/zsh.mrconfig
59 | | |-- gitconfigs.mrconfig -> ../available.d/gitconfigs.mrconfig
60 | | |-- tmux.mrconfig -> ../available.d/tmux.mrconfig
61 | | `-- vim.mrconfig -> ../available.d/vim.mrconfig
64 | |-- zsh.git -----------+
65 | |-- gitconfigs.git |
69 |-- .zshrc <----------------------+
74 In this setup, ~/.mrconfig looks like:
78 include = cat ~/.config/mr/config.d/*
80 The files you see in ~/.config/mr/available.d are mr configuration files that
81 contain the commands to manage (checkout, update etc.) a single repository.
82 vcsh repo configs end in .vcsh, git configs end in .git, etc. This is optional
83 and your preference. For example, this is what a zsh.mrconfig with read-only
84 access to my zshrc repo looks likes. I.e. in this specific example, push can
87 [$HOME/.config/vcsh/repo.d/zsh.git]
88 checkout = vcsh clone 'git://github.com/RichiH/zshrc.git'
89 update = vcsh run bash git pull
90 push = vcsh run bash git push
91 status = vcsh run bash git status
93 ~/.config/mr/available.d contains *all available* repositories. Only
94 files/links present in mr/config.d, however, will be used by mr. That means
95 that in this example, only the zsh, gitconfigs, tmux and vim repositories will
96 be checked out. A simple `mr update` run in $HOME will clone or update those
97 four repositories listed in config.d.
99 ~/.config/vcsh/repo.d is the directory into which vcsh clones the git
100 repositories. Since their working trees are configured to be in $HOME, the
101 files contained in those repositories will be put in $HOME directly (see .zshrc
104 vcsh will check if any file it would want to create exists. If it exists, vcsh
105 will throw a warning and exit. Move away your old config and try again.
106 Optionally, merge your local and your global configs afterwards and push with
107 `vcsh run foo git push`.
109 ## Moving into a New Host ##
111 To illustrate further, the following steps could move your desired
112 configuration to a new host.
114 1. Clone the mr repository (containing available.d, config.d etc.); for
115 example: `vcsh clone git://github.com/RichiH/vcsh_mr_template.git`
116 2. Choose your repositories by linking them in config.d (or go with the default
117 you may have already configured by adding symlinks to git).
118 3. Run mr to clone the repositories: `cd; mr update`.
121 Hopefully the above could help explain how this approach saves time by
123 1. making it easy to manage, clone and update a large number of repositories
125 2. making it unnecessary to create symbolic links in $HOME (thanks to vcsh).
129 [1] http://kitenet.net/~joey/code/mr/