Why?
- track changes
- simplify setup and maintenance
- simplify distribution
- ease of use: Git (or u don’t need another tool)
How to track dotfiles
git init --bare ~/dotfiles.git
alias .G="git --work-tree=$HOME/ --git-dir=$HOME/dotfiles.git"
.G add ~/.gitcofig
.G status -s -uno # review chagelist
.G commit -a -m 'Git: adding user config'
You may want to keep .G
alias
alias .G >> ~/.bashrc
Now we need to specify ignores and track .gitignore
file.
- rename
~/.gitignore
to~/.gitignore-global
and specify it in ~/.gitconfig so it can be used as repository ignores file not a user’s one. - ignore everything by default and track only required stuff:
# ignore all by default
/*
# do not ignore:
!bin/
!.bash/
!.vim/
!.ruby/
How to distribute dotfiles
git clone --bare https://github.com/gmarik/dotfiles.git ~/dotfiles.git
#setup bash alias so it can be invoked from anywhere, whenever dotfiles changes are needed
alias .G="git --git-dir=$HOME/dotfiles.git --work-tree=$HOME/"
# commit original files in orig branch for backup
# WARNING: backup what's going to be overwritten
.G status -s -uno # review changelist
.G checkout -b original_files
.G commit -a -m 'original files'
.G checkout master ~/
At this point we should have all dotfiles in place.
PS
$ git --version
git version 1.7.3
TODO
- √ symlinks point to
~/gmarik
should be$HOME
- security: how to keep sensitive info