Git-based dotfile management without symlinks (#note)

My dotfiles are powering multiple machines, and overall I’ve been happy with them. They include hand-written shell scripts to create symlinks, download all desktop apps and CLI tools, and get my preferred system settings in place. B…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

My dotfiles are powering multiple machines, and overall I've been happy with them. They include hand-written shell scripts to create symlinks, download all desktop apps and CLI tools, and get my preferred system settings in place. But overall, they've become a Frankenstein over time because many random scripts are doing random things. And obviously, I failed to document what's going on properly.

Sure, scripts have to run to install stuff, but for config file management, most solutions I've seen seemed too complicated to keep some files in sync. And I really don't want to use a dotfile framework to pull some configuration files.

What if there is a way to tweak Git and track all the .*rc and config files?

"Dotfiles management" describes Git magic to track all files somewhere on your machine from a single .git repository. Yes, your read that right. Any file and anywhere.

alias dotfiles='git --git-dir=/home/mx/.dotfiles --work-tree=/'

That's right; there's a .git folder somewhere on your machine (/home/mx/.dotfiles in the example), and it'll track all the files no matter where they're located, thanks to the --work-tree argument. Then there's no symlink dance!

With some additional configuration, you can add and sync files across machines without scripts using dotfiles add or dotfiles commit. It's all just plain Git.

This dotfiles approach is by far the smartest I've seen, and I'll definitely give it a shot when I fiddle with my system config the next time.


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2023-02-11T23:00:00+00:00) Git-based dotfile management without symlinks (#note). Retrieved from https://www.scien.cx/2023/02/11/git-based-dotfile-management-without-symlinks-note/

MLA
" » Git-based dotfile management without symlinks (#note)." Stefan Judis | Sciencx - Saturday February 11, 2023, https://www.scien.cx/2023/02/11/git-based-dotfile-management-without-symlinks-note/
HARVARD
Stefan Judis | Sciencx Saturday February 11, 2023 » Git-based dotfile management without symlinks (#note)., viewed ,<https://www.scien.cx/2023/02/11/git-based-dotfile-management-without-symlinks-note/>
VANCOUVER
Stefan Judis | Sciencx - » Git-based dotfile management without symlinks (#note). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/02/11/git-based-dotfile-management-without-symlinks-note/
CHICAGO
" » Git-based dotfile management without symlinks (#note)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2023/02/11/git-based-dotfile-management-without-symlinks-note/
IEEE
" » Git-based dotfile management without symlinks (#note)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2023/02/11/git-based-dotfile-management-without-symlinks-note/. [Accessed: ]
rf:citation
» Git-based dotfile management without symlinks (#note) | Stefan Judis | Sciencx | https://www.scien.cx/2023/02/11/git-based-dotfile-management-without-symlinks-note/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.