Live data from Hacker News

Using GNU Stow to manage your dotfiles

brandon.invergo.net

21–30 of 69 posts

Re: Using GNU Stow to manage your dotfiles

#21

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

This is exactly what I do and I think it works fantastically. I also have the same problem with initial clone and I keep meaning to write a script to automate it (especially in a push sort of way where I just specify the host that I want to convert and it does it over ssh with git push).

I also make an effort to push my config files into .config wherever possible. I really hate the ~ dotfile clutter.

Re: Using GNU Stow to manage your dotfiles

#22

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

I just made ~/.git and ignore everything with .gitignore, whitelisting files I want to commit: https://github.com/burke/dotfiles/blob/master/.gitignore

It works really well for me.

Re: Using GNU Stow to manage your dotfiles

#24

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

The one thing I like about stow is that I can choose to only add configurations that make sense for the machine I am using. If don't have a certain application, I don't 'stow' the configuration for that application in my home directory.

Re: Using GNU Stow to manage your dotfiles

#25
post #22

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

I just made ~/.git and ignore everything with .gitignore, whitelisting files I want to commit: https://github.com/burke/dotfiles/blob/master/.gitignore It works really well for me.

I remember giving advice once, to someone who did that and then

    git clean -dfx

Re: Using GNU Stow to manage your dotfiles

#26
I maintain environments on Windows (Cygwin), Linux, OS X and Solaris machines.

Some of these are work, some are home. Not all files overlap.

Additionally, I have scripts that are only relevant when I have a certain program installed, or a certain source tree available.

I ended up spending a weekend writing my own system that composed a PATH, .bashrc, .bash_profile etc. based on machine configuration. A single git clone isn't quite enough, especially if you don't want to smash everything into one repo (I don't have my home stuff installed at work, for example).

Re: Using GNU Stow to manage your dotfiles

#28

I just have a dotfiles repo on github that I clone to any new computer I'm using. Then make a symbolic link between the dotfiles and the repo (`ln -s ~/dotfiles/.whatever ~/.whatever`). Super simple.

This is almost exactly the same strategy, only stow handles the symlinks for you, so you don't have to go through and `ln -s` all your files/directories. Your dotfiles still go in a git repo.

Re: Using GNU Stow to manage your dotfiles

#29
post #22

Earlier quoted context omitted.

I just made ~/.git and ignore everything with .gitignore, whitelisting files I want to commit: https://github.com/burke/dotfiles/blob/master/.gitignore It works really well for me.

I remember giving advice once, to someone who did that and then git clean -dfx

That is especially problematic with gits directory traversal behavior. If you are in a wrong directory inside your home, you might accidentally nuke your homedir instead of the intended repo.

Re: Using GNU Stow to manage your dotfiles

#30

Since I have a setup script I run on any new installation creating symlinks from my git repo isn't a big deal. https://github.com/aclough/dotfiles/blob/master/setup.sh

I just move stuff to my home-folder with a very simple Ruby install script. It checks for existence of tools, and if they aren't there they will be installed, and the config files will be overridden.

https://gist.github.com/kaspergrubbe/99853334b0e91b540a34

Post reply on HN