by tonymet · 1y ago · 0 comments
1. git is already there and familiar
2. sync dotfiles over ssh . no internet access or separate credentials needed (for github, s3 etc)
3. handles merge conflicts
4. easily push & pull subdirectories into /etc , /usr/local or wherever else you need configuration using git subtree.
git bare repo works for tracking files anywhere on the FS as well. (check debian etckeeper for automating that)
thinking of git as a FS content & metadata tracker rather than SCM , opens up a lot of unique deployment patterns that developers often overlook
1. git init /etc
2. git init /home
3. (in home) git remote add s/etc /etc
4. (in home) git subtree add -P etc s/etc master # adds a prefix etc , from remote s/etc . This starts the subtree syncing
You can now edit files in either place. to pull changes from /etc: git subtree pull. to push changes to etc: git subtree push. git is now managing the commit shas and diffs for both directories.
The home repo is the "canonical" one that you backup , push to github/gitlab etc. /etc can just stay local for "deployment".
You can take it a step further by editing the home repo on another machine. this pattern lets you fan in and out to multiple machines and etcs so you can manage all of the variations from a single repo.
describing it is more complicated than just doing it. It's really just push/pull which triggers a normal merge over multiple directories.
git subtree push -P pi4.local pi4.local master