2

I am using a system that, during high load, automatically fires up a new server, downloads the application code from Github, and deploys an HTTP server. However, I don't want to pull the latest commit from the master branch of the repo, but rather the latest tagged commit. Is this possible? If so, how?

Thanks!

Mark Bao
  • 896
  • 1
  • 10
  • 19

3 Answers3

4

AFAIK, no; but how about having a 'deploy' branch which always contains the code you want to deploy? Work on the master as usual, but whenever the code is in a stable state push to 'deploy'.

damian
  • 3,604
  • 1
  • 27
  • 46
1

I think what you want to do is fetch just the latest tags. If that is the case, then you can do it with git-fetch:

get fetch -t
Chaitanya Gupta
  • 4,043
  • 2
  • 31
  • 41
1

You can use git describe to get the "nearest" name of a tag, then check out that tag after parsing the markup away.

git describe --long | sed 's/-[0-9]*-g[a-f0-9]*//'

You may want to use --tags as an argument to git-describe, depending on your needs.

Seth Robertson
  • 30,608
  • 7
  • 64
  • 57
  • +1 Nice one! However, this must be combined with git fetch so the latest tags are updated, unless the repo is always being cloned. – rtn Jun 15 '11 at 10:36
  • @Magnus: Well, reading between the lines, the OP deployed experimental code and wants the system to auto-rollback to a known good (tagged) state. So fetching is probably not needed in this instance. – Seth Robertson Jun 15 '11 at 14:45