Git branch deploy

8 views
Skip to first unread message

pru...@gmail.com

unread,
Nov 13, 2007, 9:11:16 AM11/13/07
to Capistrano, yimt...@noxa.nl
Hi all!

I think I have a correction to the git SCM module. Let me give you a
quick scenario first.
Normally, me and my team develop in the master branch, and when we
deploy using capistrano, we tag our release and create a release
branch for future hotfixes. This is done by tagging locally, creating
a local branch and pushing both tag and branch to the server. After
that we deploy from the tag, or from the branch (in case of a
hotfix).

When deploying, the git scm module does a "git checkout -b deploy
#{branch}" after cloning the repository. This works when deploying
the master branch or a tag (since tags are always available when
cloning a repo), but not for other branches. This is because of the
fact that remote branches aren't cloned implicitly.

Long story short: a fix would be to to change line 120 from:

execute += "cd #{destination} && #{git} checkout -b deploy #{branch}"

to:

execute += "cd #{destination} && #{git} checkout -b deploy origin/
#{branch}"

A workaround is to tag every time we want to deploy from a different
branch then master.

Grtz,

Wouter

Scott Chacon

unread,
Nov 13, 2007, 10:03:15 AM11/13/07
to capis...@googlegroups.com
I'm a bit confused - why don't you just add 'origin/' to the :branch variable in your deploy.rb?

set :branch 'origin/my_branch'

Scott

pru...@gmail.com

unread,
Nov 16, 2007, 4:37:04 AM11/16/07
to Capistrano
Oh my,

I really didn't think of that easy solution.. *shame*.
I need some coffee..

On Nov 13, 4:03 pm, "Scott Chacon" <scha...@gmail.com> wrote:
> I'm a bit confused - why don't you just add 'origin/' to the :branch
> variable in your deploy.rb?
>
> set :branch 'origin/my_branch'
>
> Scott
>
Reply all
Reply to author
Forward
0 new messages