<p>I have 3 Linux machines, and want some way to keep the dotfiles in their home directories in sync. Some files, like .vimrc, are the same across all 3 machines, and some are unique to each machine.</p>

<p>I've used SVN before, but all the buzz about DVCSs makes me think I should try one - is there a particular one that would work best with this? Or should I stick with SVN?</p>

[{'answer_id': 38367, 'author': 'John Millikin', 'author_id': 3560, 'author_profile': 'https://Stackoverflow.com/users/3560', 'pm_score': 2, 'selected': False, 'text': '<p>Any DVCS would likely work fine. My favorite is <a href="http://bazaar-vcs.org/" rel="nofollow noreferrer">Bazaar</a>. It would be easiest to keep your config files in .config, version that, and then symlink as appropriate.</p>\n\n<p>A benefit of DVCS is that you can version the per-machine config files as well, without interfering with versioning global configs.</p>\n'}, {'answer_id': 38376, 'author': 'Paul de Vrieze', 'author_id': 4100, 'author_profile': 'https://Stackoverflow.com/users/4100', 'pm_score': 0, 'selected': False, 'text': "<p>Version control software isn't really great for home directories. Worse, some software doesn't really like the .svn folders or starts to interpret their contents. You could of course try to fix this with some very complex mirroring setup, but that's hard.</p>\n"}, {'answer_id': 38381, 'author': 'Thomas Vander Stichele', 'author_id': 2900, 'author_profile': 'https://Stackoverflow.com/users/2900', 'pm_score': 3, 'selected': True, 'text': '<p>I\'ve had the same problem, and built a tool on top of Subversion that adds permission, ownership and secontext tracking, keeps the .svn directories out of the actually versioned trees, and adds a concept of layers so you can for example track all your config related to development, which you then only check out on machines you use for developing.</p>\n\n<p>This has helped me organize my settings much better across the 50+ machines I log into.</p>\n\n<p><a href="https://thomas.apestaart.org/thomas/trac/wiki/projects/savon" rel="nofollow noreferrer">Here\'s the project page</a>.  It\'s still a little rough around the edges, but we also use it at work to version system configuration for our 60+ servers.</p>\n\n<p>In general, any version control system that uses some sort of metadata files to track stuff is going to cause you pain as is when actually using it.</p>\n'}, {'answer_id': 38393, 'author': 'Sam Hasler', 'author_id': 2541, 'author_profile': 'https://Stackoverflow.com/users/2541', 'pm_score': 0, 'selected': False, 'text': '<p>Here\'s a Mozilla developer that\'s tried to do this: <a href="http://www.silfreed.net/blog/2008/07/Version-controlling-my-home-dir" rel="nofollow noreferrer">Version controlling my home dir</a>, there\'s a couple of suggestions in the comments.</p>\n'}, {'answer_id': 326461, 'author': 'Norman Ramsey', 'author_id': 41661, 'author_profile': 'https://Stackoverflow.com/users/41661', 'pm_score': 3, 'selected': False, 'text': '<p>I\'ve had this problem for years, and I don\'t think version control is necessarily the right way to go.  I\'ve had good success with the <a href="http://www.cis.upenn.edu/~bcpierce/unison/" rel="noreferrer">the Unison file synchronizer</a> which is designed for the express purpose of maintaining consistent home directories on two machines.  I\'m currently managing seven replicas with unison, and the details are a bit tricky, but it is a great tool and if you start with two you will be extremely pleased.</p>\n\n<p>The key difference between Unison and a VCS is that Unison is willing to delay dealing with conflicts that have to be merged.  Plus it gets all the defaults right.  And it is fast: I use it daily, over a DSL line, to synchronize about 40GB of data.</p>\n'}, {'answer_id': 731188, 'author': 'FlemishBeeCycle', 'author_id': 73531, 'author_profile': 'https://Stackoverflow.com/users/73531', 'pm_score': 0, 'selected': False, 'text': '<p><a href="http://git-scm.org/" rel="nofollow noreferrer">git</a> or <a href="http://www.selenic.com/mercurial/" rel="nofollow noreferrer">Mercurials</a>\'s cheap branching would work great for this situation. I started with Mercurial, because it is simpler, but have subsequently moved to git.</p>\n'}, {'answer_id': 731209, 'author': 'simon', 'author_id': 14143, 'author_profile': 'https://Stackoverflow.com/users/14143', 'pm_score': 0, 'selected': False, 'text': "<p>One way to handle this very flexibly is to have a build directory under revision control, not try and svn your actual home directory (which has its own issues)</p>\n\n<p>so inside this you keep a structure like</p>\n\n<pre>\n/home/you/code/dotfiles\n/home/you/code/dotfiles/dotbashrc\n/home/you/code/dotfiles/dotemacs\n...\n/home/you/code/dotfiles/makefile\n</pre>\n\n<p>and the makefile can contain logic for specializing files (or not)</p>\n\n<p>might be heavier than you need, but if your actual setup is complex (I've done this across 3 or 4 different unices at a time) then it's worth doing something like this.</p>\n"}, {'answer_id': 731430, 'author': 'hillu', 'author_id': 72344, 'author_profile': 'https://Stackoverflow.com/users/72344', 'pm_score': 0, 'selected': False, 'text': '<p>I use git for this. So far, I have been able to keep the home directories on several machines synchronized, with no need for branching and merging. Instead, I use <code>git rebase</code>. Conflicts so far have been few and far between and easy to resolve.</p>\n\n<p>I keep files that need to have separate contents out of revision control by putting them into <code>.gitignore</code>.</p>\n\n<p>I keep configuration files for the following tools in git:</p>\n\n<ul>\n<li>various shells</li>\n<li>emacs and applications, i.e.\n\n<ul>\n<li>gnus</li>\n<li>BBDB</li>\n<li>emacs-w3m</li>\n</ul></li>\n<li>mutt</li>\n<li>screen</li>\n<li>various utilities and scripts</li>\n</ul>\n\n<p>I keep notes and such in a subdirectory which has its own git repository.</p>\n'}, {'answer_id': 731551, 'author': 'Jay', 'author_id': 20840, 'author_profile': 'https://Stackoverflow.com/users/20840', 'pm_score': 0, 'selected': False, 'text': '<p>I would suggest looking into <a href="http://joey.kitenet.net/code/etckeeper/" rel="nofollow noreferrer"><strong>etckeeper</strong></a> if you haven\'t already. It\'s designed for versioning configuration files in /etc using a version control system: </p>\n\n<blockquote>\n  <p>etckeeper is a collection of tools to\n  let /etc be stored in a git,\n  mercurial, darcs, or bzr repository.\n  It hooks into apt (and other package\n  managers including yum and pacman-g2)\n  to automatically commit changes made\n  to /etc during package upgrades. It\n  tracks file metadata that revison\n  control systems do not normally\n  support, but that is important for\n  /etc, such as the permissions of\n  /etc/shadow. It\'s quite modular and\n  configurable, while also being simple\n  to use if you understand the basics of\n  working with revision control.</p>\n</blockquote>\n\n<p>Although it\'s designed for /etc I think it would probably also work well (perhaps with some adaptation) for home directories since the basic needs are the same. </p>\n'}, {'answer_id': 4963407, 'author': 'vrillusions', 'author_id': 185762, 'author_profile': 'https://Stackoverflow.com/users/185762', 'pm_score': 0, 'selected': False, 'text': "<p>I know this is an old thread but found it while searching for some dotfiles.</p>\n\n<p>My current system is using subversion.  The key thing I did was check out the working copy into ~/.svnhome/ (in hindsight should have called it .dotfiles or something more generic).  I then create symlinks to the files I actual use on that computer into home.  For example my .procmail and .spamassassin folders are only needed on the mail server so I don't link those on my home server.  </p>\n\n<p>The only file that has some differences is the .bashrc file has some extra lines on my mac for macports.  So at the bottom of .bashrc I have it check if .bashrc_local exists and parses that.</p>\n\n<p>This is the last remaining thing I have using subversion (everything else is using git aside from work).  The benefit of svn is <em>because</em> it's not a dvcs so I don't have to worry about accidentally committing on one server and forgetting to push it.</p>\n\n<p>I have considered moving it to git so I could create branches.  Using the above example I would have a branch for my main server that I would add the .procmail and .spamassassin folders but not have those in the master branch.  But the current system has worked fine for years--before git even existed--and don't have any particular motivation to change it now.</p>\n"}]
['https://Stackoverflow.com/questions/38362', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2461/']