prezto icon indicating copy to clipboard operation
prezto copied to clipboard

Update correctly keeping the changes.

Open simonbcn opened this issue 8 years ago • 11 comments

Actually to update prezto I have to execute this: git pull && git submodule update --init --recursive in $HOME.zprezto but the configuration files like .zshrc, .zpreztorc,... point to that folder and this prevents the update. I think it's necessary an update script that does the update correctly keeping the user changes.

simonbcn avatar Apr 20 '16 11:04 simonbcn

Does it still fail if you hardlink instead of symlink those files?

sorin-ionescu avatar Apr 21 '16 00:04 sorin-ionescu

The problem isn't the link type. The problem is that within the git folder there are configuration files susceptible to be modified by the user. These files should be outside of that folder. Something similar to oh-my-zsh system.

simonbcn avatar Apr 21 '16 08:04 simonbcn

👍 for having an additional loaded config file, that is user editable and that will not get overwritten by the user.

This have happened to me twice now, since i forget doing a hardcopy of the file.

henrikbjorn avatar Apr 21 '16 08:04 henrikbjorn

Stash, update, pop like Homebrew is better.

sorin-ionescu avatar Apr 21 '16 18:04 sorin-ionescu

Can you explain why it is better? I don't really see the problem or loading an additional file if it exists.

henrikbjorn avatar Apr 22 '16 08:04 henrikbjorn

If I execute stash I lost my changes. README.md says:

.... Prezto has one user-local configuration file. ....

This isn't true because all ZSH user-local configuration files are in .zprezto folder and they are modified by prezto installation:

$ ls -la 
....
lrwxrwxrwx  1 root root   29 ago  6  2015 .zlogin -> /root/.zprezto/runcoms/zlogin
lrwxrwxrwx  1 root root   30 ago  6  2015 .zlogout -> /root/.zprezto/runcoms/zlogout
lrwxrwxrwx  1 root root   32 ago  6  2015 .zpreztorc -> /root/.zprezto/runcoms/zpreztorc
lrwxrwxrwx  1 root root   31 ago  6  2015 .zprofile -> /root/.zprezto/runcoms/zprofile
lrwxrwxrwx  1 root root   29 ago  6  2015 .zshenv -> /root/.zprezto/runcoms/zshenv
lrwxrwxrwx  1 root root   28 ago  6  2015 .zshrc -> /root/.zprezto/runcoms/zshrc
....

The best solution is include new configuration files with a custom name and source them into their ZSH respective files. For example:

$ tail -n 3 /root/.zprezto/runcoms/zshrc
....
if [[ -r "${ZDOTDIR:-$HOME}/.myzshrc" ]]; then
  source "${ZDOTDIR:-$HOME}/.myzshrc"
fi

simonbcn avatar Apr 22 '16 09:04 simonbcn

@simonbcn that seems to be a good approach to me. Instead of having personal custom config files in "${ZDOTDIR:-$HOME}/", it would be better to have a directory within ~/.zprezto for personal configuration, such as, ~/.zprezto/private/ (gitignored) which can be managed using scm if a user prefers to keep track of changes.

rakkesh avatar Jun 15 '16 18:06 rakkesh

There's been some discussion on this in #1346

belak avatar Nov 10 '17 19:11 belak

Typically for update i use

git pull --rebase --autostash

Never had any issues

driverpt avatar Jan 27 '20 14:01 driverpt

+1 @rakkesh

woopstar avatar Sep 24 '21 09:09 woopstar