Official manual upgrade instructions
https://github.com/nvm-sh/nvm#manual-upgrade
(
cd "$NVM_DIR"
git fetch --tags origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"Slightly simplified:
(
cd "$NVM_DIR"
git fetch --tags origin
git checkout "$(git describe "$(git rev-list --tags="v[0-9]*" --max-count=1)")"
) && \. "$NVM_DIR/nvm.sh"Simplifications:
- Move the pattern check to the rev-list command:
--tags="v[0-9]*" - Remove
--tagsfrom thedescribecommand because we already restricted the lookup to being a tag - Remove
--abbrev=0from the describe command because it serves no purpose.