2

I'm trying to manage my dotfiles under version control. My dotfiles repos contains a xfce-base folder, this folder contains the .config/xfce4/.../xy-setting.xml stuff. I can stow, or better, symlink to the correct place, everything works as expected.

But, when I open one of the xfce settings editors (Window Manager, Keyboard Shortcuts), the changes made ther do overwrite my symlink with a normal file. So, adieu version control. I guess this would not happen, If I had hard links, right? Is hard linking possible with gnu stow (doesnt seem so?), or are there any alternatives?

EDIT: I came across this, does hard links, but doesn't work recursivly (complains about existing .config directory...)

EDIT II: I'm still not sure if a hard link is a good solution.

4

You are correct that GNU Stow doesn't support hard-linking currently. However I think you're also correct in that hard-linking probably isn't any better a solution than symlinking, because if an external application will happily replace a symlink with a normal file then it can certainly also break a hard link (i.e. replace the inode).

However, I do have some good news for you :-) I also use GNU Stow to manage my dotfiles, which is why in 2.1.3 I specifically added the --adopt option to help deal with precisely this scenario. After an external program has broken your symlink, you can simply restow with this option, and then the potentially changed version of the file will be adopted into your Stow package directory and the symlink restored, with the net effect of no change to the contents of the file. Since you track your dotfiles via version control, you can then see what has changed (e.g. via git diff) and then if you want, check in some or all of the changes.

N.B. For package directories which are not tracked in a version control system, this is a risky option because it can modify the contents of the Stow package with no way of undoing the changes.

  • 1
    this is perfect! have already read over it, but was not yet familiar with the terms (stow, unstow, stow directery..) so I didn't get it ;-) good explenation, thanks! – benzkji Nov 20 '16 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.