Improve installation and upgrade instructions#1179
Conversation
| To activate nvm, you need to source it from your shell: | ||
| 1. clone this repo | ||
| 2. check out the latest version | ||
| 3. activate nvm by sourcing it from your shell |
There was a problem hiding this comment.
please use 1. throughout since ordered lists are autonumbered (for easier diffing/reordering)
There was a problem hiding this comment.
Oh of course. I'll fix shortly.
There was a problem hiding this comment.
This has been fixed now.
| ( | ||
| git clone https://github.com/creationix/nvm.git ~/.nvm | ||
| cd ~/.nvm | ||
| git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` |
There was a problem hiding this comment.
what versions of git support --match? I don't want to raise the minimum bar for git support if I can avoid it.
There was a problem hiding this comment.
I found it in the oldest version that the git documentation tells me about, 1.8.1.6. https://git-scm.com/docs/git-describe/1.8.1.6
I wanted an answer, so I cloned git and used git blame and traced it back to 30ffa603 from 2007. https://git.kernel.org/cgit/git/git.git/commit/?id=30ffa603 I found it mentioned in the release notes for git v1.5.5. https://git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/1.5.5.txt
What is the current minimum bar for git support?
There was a problem hiding this comment.
Sadly it's not documented - I'm just very cautious about adding new git arguments. That seems old enough that it won't be a concern.
7fdeab4 to
99e41dd
Compare
I recently ran the upgrade instructions and I ended up with the version I was already on. This happened because `git describe` describes a commit using the most recent tag reachable from it. Since I already had a tag checked out, it was describing the tag I had already checked out. Thankfully, `git describe` accepts an optional commit-ish, which it will use instead of what we have currently checked out. Testing this in my terminal now gives me the latest tag on origin, which is what I am interested in when updating to the latest version. ~/.nvm ❯❯❯ git describe --abbrev=0 --tags v0.30.1 ~/.nvm ❯❯❯ git describe --abbrev=0 --tags origin v0.31.3 I also added it to the manual install instructions for consistency and extra safety.
`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.
I recently upgraded my copy of nvm and I was disappointed to be dropped in the .nvm directory at the end of it. I also didn't like having to copy and paste two separate blocks of code into my terminal, because I missed the second one the first time around and was left in a slightly confusing state. So, I decided to make this easier by utilizing subshells and moving all of the instructions into one code block in this document. I think this will improve people's experience maintaining this tool.
As suggested by @ljharb, this might be a little cleaner. I'm not entirely sure, but in any case, it is consistent with the upgrade instructions, so that is nice.
ed4a9cd to
6eef4ce
Compare
|
Rebased. |
Ensure
git describegives latest tagI recently ran the upgrade instructions and I ended up with the version
I was already on. This happened because
git describedescribes acommit using the most recent tag reachable from it. Since I already had
a tag checked out, it was describing the tag I had already checked out.
Thankfully,
git describeaccepts an optional commit-ish, which it willuse instead of what we have currently checked out. Testing this in my
terminal now gives me the latest tag on origin, which is what I am
interested in when updating to the latest version.
I also added it to the manual install instructions for consistency and
extra safety.
Ensure
git describeonly matches version tagsgit describewill match the latest tags, regardless of what it lookslike. We can make this a little safer by adding a
--matchflag tomatch 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.
Use subshells for installation and upgrade instructions
I recently upgraded my copy of nvm and I was disappointed to be dropped
in the .nvm directory at the end of it. I also didn't like having to
copy and paste two separate blocks of code into my terminal, because I
missed the second one the first time around and was left in a slightly
confusing state. So, I decided to make this easier by utilizing
subshells and moving all of the instructions into one code block in this
document. I think this will improve people's experience maintaining this
tool.