The vcsh write-gitignore command

I’ve been using vcsh for a few months now and am very happy with it.

Currently I’m using two repos - a home repo which is really just a continuation of my old mercurial (previously subversion) home dir; and a past repo which is where all my history files are stored.

One issue I had was that while vcsh st worked fine, vcsh home st really didn’t - showing me all the files that weren’t tracked by git. I’d seen that vcsh had a write-gitignore command but hadn’t looked into it a lot.

This morning before heading into work I finally did. I had been turned off because what it did was dump * followed by a line for each tracked file negating that frst line: !/tracked/file. This was rather ugly but this morning I very belatedly realised that I could edit it and I could commit it. So now the ignore file (.gitignore.d/past) for the past repo looks like this:

*
!/.config/vcsh/hooks-enabled/past.pre-pull
!/.gitignore.d
!/.gitignore.d/past
!/.history.d
!/.history.d/**

Which is far nicer to look at that the 50 line thing write-gitignore first managed. It’s a useful command to generate a staring point; horrible thereafter. There are a few tricks to note.

First, git doesn’t track directories, but you’ll need to put each dir into the ignore file. Say you wanted to track all files in ~/foo/bar/kitten you’d need the following entries:

!/foo
!/foo/bar
!/foo/bar/kitten
!/foo/bar/kitten/**

Second, you need that last line with the ** to track all files/dirs below it.

Next up in making vcsh more useful is to sync ~/Maildir in a mail vcsh repo. I’ll write about that after some experience with it.