# Use "git describe" for version number display

**URL:** https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587
**Category:** Feature
**Created:** [February 23, 2015, 10:10pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587 "2015-02-23T22:10:27Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 23, 2015, 10:10pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/1 "2015-02-23T22:10:27Z")

</div>

Currently, people on the `tests-passed` branch see in the dashboard that they are running a “beta” version, when that isn’t quite the case.

The `git describe` command has a pretty meaningful output for Discourse:

```plaintext
$ git checkout master
$ git describe
v1.3.0.beta1-47-gca57300
$ git checkout v1.3.0.beta1
$ git describe
v1.3.0.beta1

```

I would like to suggest using the `git describe` output to represent both (a) how long it has been since the beta and (b) if the currently running version of Discourse is carrying unsupported patches (through a sha mismatch and number increment).

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 23, 2015, 11:33pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/2 "2015-02-23T23:33:13Z")

</div>

Sure, put through a PR

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 23, 2015, 11:34pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/3 "2015-02-23T23:34:04Z")

</div>

I posted a topic because I _think_ this will need some ‘mothership’ changes as well, so I’ll go ahead and write the Discourse side.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 23, 2015, 11:37pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/4 "2015-02-23T23:37:25Z")

</div>

I am not sure anything is required on mothership, though I would start with only doing “describe” on tests-passed branch. Process wise we can be more militant on stable and beta always getting a new tag per commit.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 23, 2015, 11:49pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/5 "2015-02-23T23:49:39Z")

</div>

![](https://global.discourse-cdn.com/meta/original/3X/2/0/2091279d3b55685b5c30f71edf34769ab3dbba9b.png)

I think it wouldn’t be a bad idea to try some `gsub` magic to turn that first dash into a plus (v1.3.0.beta1+48-g34dc1f9).

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 23, 2015, 11:51pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/6 "2015-02-23T23:51:49Z")

</div>

we should totally only be doing this if you are on the master branch. but yeah, seeing guids can be kind of scary, I would suppress it from the UI and allow people to click to expand or something.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 23, 2015, 11:53pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/7 "2015-02-23T23:53:31Z")

</div>

Version 2:

![](https://global.discourse-cdn.com/meta/original/3X/4/8/4814a60ce6a6e442f188c35b9794c247c26e171c.png)  
 ![](https://global.discourse-cdn.com/meta/original/3X/e/f/efbcf84fda042b44597a734e5574eb69df3eb05a.png)

> [@sam](#):
>
> only be doing this if you are on the master branch

Well, as you can see above from my screenshot of checking out the beta branch, that shouldn’t be an issue!

The `-dirty` is due to my changes not being committed.

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [February 23, 2015, 11:55pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/8 "2015-02-23T23:55:26Z")

</div>

> [@riking](#):
>
> The -dirty is due to my changes not being committed.

![](https://global.discourse-cdn.com/meta/original/3X/2/2/2266af44724f8ec00d3af1bc7d1c6eaa4b82702f.gif)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 23, 2015, 11:59pm UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/9 "2015-02-23T23:59:18Z")

</div>

Actually the nicest thing to display to the user is number of commits since that tag… so:

V1.3.0+22

22 commits after tag V1.3.0 … no need to look at hashes there.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 24, 2015, 12:07am UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/10 "2015-02-24T00:07:41Z")

</div>

I can do that:

![](https://global.discourse-cdn.com/meta/original/3X/0/5/05e19be7e40985cd26a852b788d56ab3d02bd14d.png)

[https://github.com/discourse/discourse/pull/3228](https://github.com/discourse/discourse/pull/3228)

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [February 24, 2015, 5:14am UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/11 "2015-02-24T05:14:33Z")

</div>

Also requested here:

> [@Show number of commits since last tag in version string](https://meta.discourse.org/t/show-number-of-commits-since-last-tag-in-version-string/19868):
>
> To better distinguish between beta and tests-passed in the Admin UI: A la git describe

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 24, 2015, 10:46am UTC](https://meta.discourse.org/t/use-git-describe-for-version-number-display/25587/12 "2015-02-24T10:46:34Z")

</div>


