Lvl 0

0 / 0
(Lvl 12)
Best way to manage dotfiles using just Git
r/linux - Best way to manage dotfiles using just Git
Post a reply.

I use this method and it works well.

My version of the script, pretty much the same:

❯ cat ~/.config/fish/functions/hit.fishfunction hit/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $argvend

I've tried other methods using stow or symbolic links and such things. This is much cleaner and easier/quicker to use.

I like to leave 'show untracked files' on when I run 'status', so I can spot things I may want to backup easily. I just dump directories I know I won't want to track into gitignore.

For a git hoster I just use a vm running openssh. Simple enough.

30, code at

# cloc dac
Language                      files          blank        comment           code
Bourne Again Shell                1             14             22             29

The one feature that I really need in a dotfile manager is to allow keeping local changes temporarily -- no other tool seems to allow that. In 29 lines of shell, I get everything I ever needed in a dotfile manager :)


As a more all-encompassing alternative, there's always NixOS. It's not just your home dot files in GIt, but your /etc and the rest of your machine configuration + hardware setup as well.


I wrote my own solution so I can store them in modules, referencing eachother. It also runs scrips, so entire systems can be installed using only this. And different ones at that, you can restrict stuff to only run when specific conditions match, like we have pacman, or systemd, or its a mac.


I do love some chezmoi though.


I'm currently happy with yadm. It basically does the same thing, and has some extra features some might find useful. I used just git before and then chezmoi for a while.

I find that having dot files under version control is the most important part. The way you manage them (custom aliases, stow, chezmoi, yadm) is a personal preference and it's great that there are many options.


I managed my dotfiles like this for a while, but recently I've taken a liking to having my dotfiles folder in ~/docs/git and hardlinking them to their respective names in ~/.config

Post Views: 13
Comments: 7

Upvotes: 2
Downvotes: 0

Decay Rate: 1
Current Score: 0
Top Score: 6
Top Post Tips
Top Comment Tips