I'd like to manage my dotfiles with a Git repository and stow
. Here is my current repository that includes the files/directories I'd like to stow and a Makefile
with the command I'm using make stow
.
Unfortunately, I have run into an issue when stow encounters non-existant directories. For example if I delete my ~/.config/yabai/
directory (to simulate it not already existing on a new install) and run make stow
it will symlink the entire directory:
$ ls -l
[...]
lrwxr-xr-x 1 adam staff 26 Mar 12 19:28 yabai -> ../.dotfiles/.config/yabai
[...]
This causes an issue because then if I, or the program create additional files in this directory, they will appear in my ~/.dotfiles/
directory as well.
This issue does not occur if the directory already exists because then the files inside it are linked instead of the directory itself:
$ ls -l
drwxr-xr-x 3 adam staff 96 Mar 12 19:43 yabai
$ ls -l
lrwxr-xr-x 1 adam staff 37 Mar 12 19:43 yabairc -> ../../.dotfiles/.config/yabai/yabairc
Based on the amount of people using stow
to manage dotfiles, I imagine there is a way to workaround this behaviour. Possibly where the directory structure is recreated first and then links are created.
--no-folding
flag? Eg.stow --no-folding yabai
– it should only link the ‘leaves’ without linking whole directories (which stow calls folding to make fewer symlinks)