Linda
Linda

Reputation: 439

Git with development and production environment

I am new to git and looking for the most efficient way to setup development and production environment with git.

I develop locally on some projects, say:

project1.local
project2.local
project3.local

When I am ready I push the changes to the server, where beta tester can work with it:

beta.project1.com
beta.project2.com
beta.project3.com

Only if betatest succeeds I would like to push the changes to production domain:

www.project1.com
www.project2.com
www.project3.com

I do understand how to connect project1.local and beta.project1.com. However, I do not really understand how to setup the connection between beta.project1.com and www.project1.com to push tested features into production.

Is git right for me?

Upvotes: 8

Views: 9063

Answers (2)

CharlesB
CharlesB

Reputation: 90456

You can use a hook, or a continuous integration tool, that would trigger different deployment target depending on which branch gets updated.

You would have a central repo, with beta and production branches. When you want to release to beta, commit it the beta branch, and push to the central repo. Then the hook or script, recognizing that the beta branch has been updated, takes action and deploy accordingly to the beta server.

Same thing for production commit.

Upvotes: 0

gpoo
gpoo

Reputation: 8638

Check "A successful Git branching model" to do more or less what you want.

In git you can have multiples repositories (git remote --help). So, in production you can have the repositories pointing to beta, and pull the changes from there. In beta, you can have both, production and development and pull changes from development and push them to production. For each case, you should handle branches, in whose case, the link given should give you enough ideas.

Upvotes: 6

Related Questions