

Why I use git and puppet to manage my dotfiles - bostonvaulter2
http://www.jaxelson.com/blog/?p=63

======
shazow
Seems that the de facto approach is to backup-rm-symlink. My approach is to
source from existing configs whenever possible. Specifically, instead of

    
    
      mv ~/.bashrc ~/.bashrc.bak; ln -s $DOTFILES_PATH/.bashrc ~/.bashrc
    

I do a slightly more sophisticated version of:

    
    
      echo "source $DOTFILES_PATH/.bashrc" >> ~/.bashrc
    

(The sophistication comes in checking if that line already exists.)

Here's my install script:
<https://github.com/shazow/dotfiles/blob/master/install.sh>

I've found many benefits in this, such as easily having machine-specific
configuration side by side with my unified dotfiles and no backup clutter.
This works especially well for things like vim configs, too.

    
    
      $ cat ~/.vimrc
      source $DOTFILES_PATH/.vimrc

~~~
blackman
interesting, as an alternative to this how about how janus does it with a
.local file?

<https://github.com/carlhuda/janus/blob/master/vimrc#L147>

------
zerosanity
I think puppet in this case is overkill. I simple bash script with a small
function to check if it already exists and what not would do just fine and you
don't have to install another application (puppet).

~~~
aonic
I agree that its overkill for the use case mentioned in the article, a
Makefile would be more than sufficient. I do the same for my vim configuration
using `make`: <https://github.com/aonic/vim-settings/blob/master/Makefile>

Usage:

    
    
      git clone https://github.com/aonic/vim-settings.git
      cd vim-settings
      make
    

Remove:

    
    
      make clean

~~~
jlogsdon
Nice method, but with a bash script you wouldn't have to manually add any new
files to your Makefile. I use this one: <https://gist.github.com/975295>. Also
handles forcibly linking a file if it exists already (with the -f flag).

Of course, you're just using it for one folder so it's not an issue for you ;)

------
adambyrtek
I prefer to keep things simple, and version the home directory directly. I
renamed the ~/.git repository to ~/.dotfiles.git in order to keep it out of
the way, and set up a broad .gitignore, which can always be overridden with
-f. When I need to work on the repository I use the GIT_DIR environment
variable. No need for managing symlinks.

~~~
bostonvaulter2
That wouldn't work so well for me because I like to keep my system
configuration files like apache's in my configuration folder as well. But I
can see why that approach appeals to you.

------
RexRollman
God, I like reading stuff like this, but personally I think articles about
keeping your entire home directory under version control are more interesting
(Joey Hess does this, I believe, and probably others I don't know about).

Stuff like this is why I enjoy Hacker News.

------
jrockway
I ended up writing my own mini-utility for this:
<https://github.com/jrockway/dotfiles/tree/master/bin>

But I think I am going to switch to puppet, because there are a few things I
always need done on a new machine; adding myself as a sudoer, installing
packages, editing the imapd config (for a local imap cache), etc.

------
tmp43522
I used to mv the old files, but now I just rm.

Host- specific files I handle by doing if [ -f ~/.host-bashrc ]; then .
~/.host-bashrc; fi

I also use proper extensions on my files like bashrc.sh and emacs.el for
automatic syntax highlighting in editors.

My shell script just goes through the current dir turning eg. bashrc.sh into a
link at ~/.bashrc

------
lars512
I do something similar with BitBucket and hg. Over time, I've found I rarely
need system specific branches any more. Each computer has a .bashrc-local for
local shell customizations, kept outside the repo. Otherwise, it's enough to
detect the OS flavor and adjust symlinks that way.

------
zcid
I just use SpiderOak. It includes my dot files during its normal backup
routine, it has file revisioning included, and all my files are available
immediately upon installing SpiderOak to a new computer.

~~~
RexRollman
Personally, I just backup my dotfiles via FTP as they don't change very often,
but I lot of my fellow Arch Linux users seem to like backing up their dotfiles
to Github. I have never used GitHub myself but everyone seems happy with it.

------
mmb
I use Rake to manage the symlink part of this

<https://github.com/mmb/config/blob/master/Rakefile>

------
coenhyde
I use homesick <https://github.com/technicalpickles/homesick>

