English 中文(简体)
Appropriate strategy for tagging and hotfixing with git
原标题:

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate.

For tagging I just tag a commit of the master trunk.

If it happens I have to hotfix the tag, I m checking out the tag (e.g. 1.0), fix the issue, commit it and re-tag it (e.g. 1.0.1). Now, if I have to do another fix on the tag, I repeat the procedure, using as first checkout the tag of the first hotfix (e.g. 1.0.1).

Now, I noted two things: 1. when I checkout the 1.0.1, I get a warning saying I m not in branch - I assume that it s ok, but is it appropriate as strategy? 2. when I try to deploy the 1.0.2, I receive an error from capistrano (tool used for deploying rails apps) during the code update from the remote repository, saying that it can t find the object [commit of 1.0.2]. I can correct this problem checking out the master and merging 1.0.2.

Of course, I m always pushing the tags to the repository.

Is there anything wrong/inefficient/inappropriate, or this is an appropriates strategy? I m completely new to git and I couldn t find around a great deal of information about the deployment strategies generally used.

最佳回答

From the tag 1.0, you need to make a branch

 $ git checkout -b hotfix1.0

on which you can go every time you need to make a fix, and on which you can make a tag (1.0.1, 1.0.2, ...) every time you need to deploy.

Working on a detached HEAd is not optimal, because that commit can be pruned later on. If you are on a detached HEAD and have made some modifications, you can always merged them with a given branch:

 $ git checkout -m hotfix1.0

I would not recommend making a branch for each hotfix you need to make for the 1.0 version of your program: one branch should be enough for that purpose, with tags along the way to mark significant modifications worthy to be published.

问题回答

I would suggest doing it this way:

Create a branch for your 1.0 tag, e.g. version-1 and apply the hotfix in it.

Tag the branch as 1.0.1.

For the next hotfix you can use the same branch or, if you deleted it, create a new one but this time from the tag 1.0.1.





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签