I use GNU Stow in order to have important .dot files, usually located in separate directories in the filesystem, version controlled in git from a designated repository. Easier to use a tool like this than to do it manually.

Steps required

  • Create a designated 'stow' directory, e.g. ~/.dotfiles.

  • Recreate the directory structure for the files you want to manage as subdir(s) of that directory.

    e.g. to have my Doom emacs config files managed by stow and they have been installed to ~/.config/doom/, i would do the following:

# N.B. directory structure
mkdir -p ~/.dotfiles/doom/.config/doom
mv ~/.config/doom ~/.dotfiles/doom/config/
cd ~/.dotfiles
# finally, invoke stow
stow doom

Now, listing the initial config directory should show a symlink pointing to new location:

ls -al ~/.config
doom -> ../.dotfiles/doom/.config/doom

Initialize a git repository in ~/.dotfiles, commit and push to remote and your done.