chezmoi
Gérez vos fichiers dotfiles sur plusieurs machines diverses, en toute sécurité.
Quelques definitions
- Le
source directoryest la source de verite.
Demarrage rapide
Initialise chezmoi. Cela créera un nouveau dépôt local git dans ~/.local/share/chezmoi où chezmoi stockera son état.. Par défaut, chezmoi ne modifie que les fichiers de la copie de travail.
$ chezmoi initAjoute un fichier dans le repo surveillé par chezmoi.
$ chezmoi add ~/.bashrcAffiche les changements que chezmoi va effectuer.
$ chezmoi diffApplique les changements
$ chezmoi -v applyPuis, on enregistre nos changements:
chezmoi cd
git add .
git commit -m 'Initial commit'
Il faut créer une repo sur github appele dotfiles et pousser nos changements:
git remote add origin https://github.com/$GITHUB_USERNAME/dotfiles.git
git branch -M main
git push -u origin main
exit
Editer un fichier
Il y a plusieurs méthodes pour mettre à jour les dotfiles.
-
Utiliser
chezmoi edit $FILE. Cela ouvrira le fichier dans votre editeur. Pour plus de facilite, utilisezchezmoi edit --apply $FILEpour appliquer les changements quand vous quittez l'editeur, ouchezmoi edit --watch $FILEpour appliquer les changements lorsque le fichier est sauvegarder. -
Use
chezmoi cdand edit the files in the source directory directly. Runchezmoi diffto see what changes would be made, andchezmoi applyto make the changes. -
If your editor supports opening directories, run chezmoi edit with no arguments to open the source directory.
-
Edit the file in your home directory, and then either re-add it by running chezmoi add $FILE or chezmoi re-add.
-
Edit the file in your home directory, and then merge your changes with source state by running chezmoi merge $FILE.