From 17a3272b8ab58b68f772a4738a5aca4825c7f152 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Thu, 28 Jul 2016 09:03:26 -0700 Subject: [PATCH] Ensure `git describe` gives latest tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index c7a887b..b6891e4 100644 --- a/README.markdown +++ b/README.markdown @@ -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` +git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags 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` +cd "$NVM_DIR" && git fetch origin && git checkout `git describe --abbrev=0 --tags origin` ``` After upgrading, don't forget to activate the new version: