[Permalink] blog code git
Tomorrow I'll be celebrating a nice round-numbered birthday. I'll be 25 :) I grew up at just the right time that powers of two have been important my whole life.
I'll be celebrating the milestone but having my brother round for the afternoon and playing on my first 32-bit computer - my A1200.
For a while now, I've been wanting to keep various parts of my home directory in sync.
At first, I created a git repository for storing my dotfiles but I found it a pain to keep the repository up-to-date.
Fairly recently, someone pointed out git-annex to me. After a good read of the documentation, it sounded like it could be useful but probably more than I needed and perhaps not quite what I really wanted. Besides, I couldn't get the bloody thing to install.
So I did what any geek would do, I wrote my own :D
Basically, I wanted an easy to way to keep a git repository in sync with an directory external to it. With git aux installed, I get pretty much exactly what I wanted with a few simple commands.
After creating a new git repository, I do
git aux init ~/ to tell git-aux that I want it to sync this repo with my home directory.
I then do
git aux add ~/.vimrc ~/.ssh/config ~/.bashrc and any other files I want from my home directory. This copies those files into the repository and I can then commit them in the usual way.
If I make changes in my home directory, I use
git aux sync to update the copies in the repository.
If I've made changes on another machine and want to apply those changes from the repo to the home dir on this machine, I do
git aux apply.
And that's it :)
It's unfinished and probably broken in places but mostly does what I was looking for.
Oh, and it's written with node of course ;)