Live data from Hacker News

Just use `git` to manage your dotfiles

ericgreer.info

11–15 of 15 posts

Re: Just use `git` to manage your dotfiles

#12
post #7
post #4

Sometimes a well-designed, purpose-built tool can replace so many kludgy solutions. This doesn’t solve the problem of reinstating the dotfiles to their original positions in a new machine. I’ve tried everything from raw git to gnu stow to manual symlinking and everything in between. They all work when the full context of the workflow is fresh in my brain. But after a few weeks I always mess up, even though I’ve docum…

I’ve been using Chezmoi. It has lots of niceness. Two things are awkward for me. Maybe you have solutions. I know my way around emacs. vimdiff is a foreign country. Often my changes are speculative or experimental. So I checkout, edit, apply and only then discover I’ve messed up. Or I can edit in place. Voila vimdiff! What’s the better way?

> I know my way around emacs. vimdiff is a foreign country.

You don't have to use vimdiff. You can use any merge tool you want. See https://www.chezmoi.io/user-guide/tools/merge/.

> Often my changes are speculative or experimental. So I checkout, edit, apply and only then discover I’ve messed up. Or I can edit in place. Voila vimdiff!

> What’s the better way?

There are lots of options. See https://www.chezmoi.io/user-guide/frequently-asked-questions....

Personally, I tend to use `chezmoi edit` and then use git in my source directory to `git add -p . && git commit` the changes I want to keep and `git checkout` to discard the changes I don't want.

Re: Just use `git` to manage your dotfiles

#13
I use https://github.com/nycksw/ocd which is just the famous StreakyCobra suggestion plus a pre-commit hook to prevent accidentally checking in your whole homedir. There's also a big ignore-file to prevent checking in secrets. I use it daily across several systems. It's intuitive if you use Git a lot. I don't miss my old pattern of farming symlinks.

Re: Just use `git` to manage your dotfiles

#14
post #4

Sometimes a well-designed, purpose-built tool can replace so many kludgy solutions. This doesn’t solve the problem of reinstating the dotfiles to their original positions in a new machine. I’ve tried everything from raw git to gnu stow to manual symlinking and everything in between. They all work when the full context of the workflow is fresh in my brain. But after a few weeks I always mess up, even though I’ve docum…

The post does say exactly how to do that. Just init your homedir as a repo, add a remote, and pull. Your dotfiles come right down on top of your new machine's home directory.
Post reply on HN