Ensure `git describe` only matches version tags

`git describe` will match the latest tags, regardless of what it looks
like. We can make this a little safer by adding a `--match` flag to
match tags that look like version tags. This allows the maintainers of
this repo to more safely add other types of tags if they so wish,
without causing people to install or upgrade to those versions.
Joe Lencioni 2016-07-28 09:10:14 -07:00
parent 17a3272b8a
commit 87a3a4425d
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ For manual install create a folder somewhere in your filesystem with the `nvm.sh
Or if you have `git` installed, then just clone it, and check out the latest version:
```sh
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags origin`
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
```
To activate nvm, you need to source it from your shell:
@ -106,7 +106,7 @@ export NVM_DIR="$HOME/.nvm"
For manual upgrade with `git`, change to the `$NVM_DIR`, pull down the latest changes, and check out the latest version:
```sh
cd "$NVM_DIR" && git fetch origin && git checkout `git describe --abbrev=0 --tags origin`
cd "$NVM_DIR" && git fetch origin && git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
```
After upgrading, don't forget to activate the new version: