twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
12.9k stars 478 forks source link

Of autoCommit and branches #3856

Closed crashkopf closed 2 months ago

crashkopf commented 2 months ago

What exactly are you trying to do?

I've set up chezmoi on 4 different machines, with each machine having it's own branch in the repository, and the master branch holding configuration that's common to all machines. The idea is that any changes I make to a machine that I want to be common to all machines can be merged to master, and the other branches re-based. I'm sure this is not an uncommon workflow.

I would like to use the git.autoCommit feature, but there's one question I have not been able to find an answer to: which branch does autoCommit commit it's changes to, and it there a way to explicitly specify the branch it should use?

My assumption is that it tries to commit to whatever branch is currently checked out in the repo, but I can see that being an issue if I've checked out another branch and forgot to switch back. The ideal would be that a branch could be specified in the config file, though I suppose that could have headaches if the working tree is dirty or something. In any event, it would be nice to get a little more information on how people usually use this feature and any potential foot-guns to watch out for.

What have you tried so far?

Reading the documentation

Where else have you checked for solutions?

GitHub issues, google searches

twpayne commented 2 months ago

I've set up chezmoi on 4 different machines, with each machine having it's own branch in the repository, and the master branch holding configuration that's common to all machines. The idea is that any changes I make to a machine that I want to be common to all machines can be merged to master, and the other branches re-based. I'm sure this is not an uncommon workflow.

This is an uncommon workflow. The key reason that chezmoi exists is to make it easier to configure multiple, diverse machines from a single source of truth.

chezmoi uses templates and other methods so you can express differences succinctly while keeping a common base. The result for you, as a user, is that you don't have to use outdated methods like raw git repos to store your dotfiles.

tl;dr if you're juggling git branches then you're holding chezmoi wrong. chezmoi has much better ways of solving your problems.

crashkopf commented 2 months ago

Okay, good to know. I'll spend some more time exploring the templating system. Thanks for pointing me in the right direction.