vcsh: use branches instead of repos?

John Whitley whitley at
Fri Jun 26 20:55:40 CEST 2015

Hi Sitaram,

This is tricky.  vcsh’s approach to overlaying fundamentally relies on having multiple git indexes available, one for each separate *working directory*.  This implies a separate .git directory (or in vcsh’s case, a separate bare repo, e.g. “vim.git”) for each overlay.  It doesn’t matter whether you’re working with multiple branches or multiple remote repos, each workdir must have a .git dir.

However, there is hope.  Check out the git-new-workdir script in git’s contrib folder.  There’s some discussion of it on Stack Overflow, here: <> <>

From the SO comments:  "It appears to instantly share history and branches between two different checked out repositories with no pushing/pulling, only symlinking.”  That looks close to what I’m guessing you want.

(Ah-ha! See this later comment on that same SO post, looks like git 2.5 is getting first-class support for multiple worktrees: <>)

I suspect it's not all the way there for vcsh’s purposes, since it creates separate full working directories vs. vcsh’s separate dir approach.  But this script probably gets you very close to creating a set of ~/.config/repo.d/{vim,bin,whatever}.git directories that all shared the relevant histories but gave you the separate branches and indexes you want.

I’ll recommend creating a bootstrap script that does the initial clone and setup for you, since the initial setup will be a touch involved.  See the “bootstrap” branch of my vcsh-root repo for ideas:

I can grab and run the bootstrap script from github, which sets up my environment using vcsh-root’s master branch as the starting point for my vcsh configuration.  The master branch stores the initial vcsh configuration and a minimal baseline of tools (esp. ~/local/bin/vcsh).  This pattern gives you a good place to put the git-new-worktree, or your modified form thereof, (e.g. because you may not have git 2.5 everywhere you’ll need it yet).

Using a bootstrapper script like this makes it trivial to setup a new dev box or VM with as much (or little) of my working environment as I need.

Good luck!

P.S. I will now meditate on the fact that this would all be nigh trivial if Plan 9’s filesystem, 9P, had become a ubiquitous feature of *nix systems.

> On Jun 26, 2015, at 10:32 AM, Sitaram Chamarty <sitaramc at> wrote:
> On 06/26/2015 10:44 PM, Richard Hartmann wrote:
>> Vcsh does support branches.
>> That being said, if you switch from branch zsh to branch vim, you will delete the copies of your zsh config in $HOME.
> Is that a documented feature or an accidental one and might it change in
> future?
>> That is most likely not what you want...
> Indeed :)
> I was hoping for a way to put everything in one *repo*, and -- one any
> new machine I come to -- I would just pick a bunch of branch names,
> depending on what features that machine/user should have.  A bit more
> convenient (than "mr" or such tools).
> _______________________________________________
> vcs-home mailing list
> vcs-home at

More information about the vcs-home mailing list