💾 Archived View for sotiris.papatheodorou.xyz › gemlog › 20230403_re_source_controlled_dotfiles.gmi captured on 2023-04-26 at 12:54:22. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-04-19)
-=-=-=-=-=-=-
I'll share my dotfile setup after a post by Senders expressing their dissatisfaction with GNU stow.
When I first put my dotfiles in version control I also used GNU stow to create symlinks from the git repository to the appropriate locations in my home directory. I created a script to automatically create those symlinks for me but I was never quite satisfied with this setup. It always felt too complex and flimsy. It didn't help that due to distro security policies for some packages their configuration files had to be regular files and not symbolic links. This meant I had to add extra logic to my stow wrapper script to copy these files instead. Nevertheless, not having any better ideas on how to do this I kept using GNU stow.
And then I read a blog post by Drew DeVault, “Managing my dotfiles as a git repository”, and have been using this method since. The main idea is that your home directory is itself a git repository with a .gitignore file containing only a single * character, thus ignoring all files by default. To add a file to the repository you just need to use the -f/--force flag of git add to override the .gitignore pattern. To set up a new computer you can run the following commands:
cd ~ git init git remote add origin <repo-url> git fetch git checkout --force <branch>
So far I haven't had any issues with this approach and it feels much more natural and straightforward.
Sotiris 2023-04-03