Pulling down a specific tag of a git repository
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 comm开发者_开发知识库it from the master branch of the repo, but rather the latest tagged commit. Is this possible? If so, how?
Thanks!
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'.
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
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.
精彩评论