Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add update command #159

Closed
twpayne opened this issue Jan 22, 2019 · 5 comments
Closed

Add update command #159

twpayne opened this issue Jan 22, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@twpayne
Copy link
Owner

twpayne commented Jan 22, 2019

chezmoi uses relies on the user's source version control system to share changes across machines. You then need to run chezmoi apply on each machine.

These commands should be merged into a single chezmoi update command that does the following:

  1. Updates the source directory according to the user's VCS (e.g. git pull --rebase if the VCS is git).
  2. Runs chezmoi apply.

This will allow a single chezmoi update on a machine to update that machine to the user's desired state.

@twpayne twpayne added the enhancement New feature or request label Jan 22, 2019
@twpayne twpayne self-assigned this Jan 23, 2019
@tralston
Copy link
Contributor

tralston commented Jul 8, 2019

@twpayne How would I do a pull without applying? Especially during testing, and adapting existing machines to the chezmoi system, I don't want to automatically overwrite everything. I'd like to:

  1. chezmoi update (to get the latest changes from my repo)
  2. Analyze it with chezmoi diff to maker sure I haven't missed something on my local system.

I tried using chezmoi update -a false and chezmoi update -a 0 but none of those will allow me to signal the update command to NOT apply right after. How can this be done?

@tralston
Copy link
Contributor

tralston commented Jul 8, 2019

I can do this by the following:

  1. chezmoi cd
  2. git pull
  3. exit
  4. chezmoi diff

It's a workaround, but still long-winded. I'd like to just run chezmoi update --no-apply && chezmoi diff or something similar.

@twpayne
Copy link
Owner Author

twpayne commented Jul 8, 2019

chezmoi apply --dry-run (or chezmoi apply -n) should do the trick.

@twpayne
Copy link
Owner Author

twpayne commented Jul 8, 2019

Sorry, what I wrote isn't quite right - the --dry-run will apply to git pull as well so it won't actually pull.

chezmoi source pull && chezmoi diff is what you want, I think.

@twpayne
Copy link
Owner Author

twpayne commented Jul 8, 2019

You asked a good question, I added it to the docs (it wasn't there before) in #391.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants