]> git.madduck.net Git - code/vcsh.git/blob - README.md

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:

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