Chezmoi as a local git working tree management tool #2871
danpizz
started this conversation in
Show and tell
Replies: 1 comment
-
This is a really cool use of chezmoi, thank you for sharing! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello there!
I've been using Chezmoi for a while to manage private or personal files in third party git repositories working trees. I'm talking about editors and IDEs configs,
.env
files, etc. that you'd like to have under source control but you cannot push to your team git repo.I found Chezmoi as a great solution to this use case and I have not seen anything similar around, so I'm sharing my experience as a way to get some feedback and maybe give something useful to the Chezmoi community.
Scenario
I'm a programmer working with a team on my employer's git repo, "Project Apollo". Project Apollo is a very simple Python app:
In the local working tree of the Apollo repo on my workstation I have a couple of extra files that I need locally:
The VSCode settings and the extra source is something I don't want to push on the Apollo repo, so what I usually do is adding those files to
.gitignore
or to.git/info/exclude
.But then I have to manually copy or update those files whenever I switch from my workstation to my notebook. It would be wonderful if I could save those files in a distinct git repository...
A git configuration management tool
Chezmoi can be used to create a kind of layered git working tree where some files belong to the main repo and some other files are managed by Chezmoi in the workspace repo.
I have been having good results with this layout:
where the workspace
.gitignore
is excluding the apollo dir:and
apollo/.git/info/exclude
excludes the files managed by chezmoi:This is the
workspace/bin/chezmoi.sh
script:I use
chezmoi.sh
to manage my personal files in the git dir in just the same way I manage my dotfiles.Extra fancy stuff
add the
bin
dir to yourPATH
and setup your virtual Python environment withdirenv
add how many repositories you need under workspace
add a postgres directory with its specific configuration for running Apollo locally
As a freelance I found this to be a good way to compartimentize client code, data and stuff in a single git-backed directory.
Beta Was this translation helpful? Give feedback.
All reactions