Can I set up my server to automatically pull updates from a branch when new commits come in?

StackOverflow https://stackoverflow.com/questions/9912107

Pergunta

Say I have a project in a git repository. The project has a branch called "Stable" or "Production" where the current version of the project is always stable. I have a production server that ideally should always have the most recent version of the stable branch. I know I could have a cron job run a pull at a specific interval, but I'm not really happy with that solution. Often I could push as much as 5 hotfixes in an hour after discovering a bug in the stable branch. I would like the production server to instantly pull those new commits once they have been pushed.

What would be the simplest way of doing this? My fallback solution will be to have my production server run a pull every minute or so, so anything short of that would be great.

Foi útil?

Solução

You could do post-commit hook which will push to the production server.

Also, the pulling every minute doesn't look as a bad solution.

Outras dicas

If you have a build server(Bamboo, Hudson, Cruisecontrol, etc...), you can also setup tasks to trigger a pull in another branch when updates are detected in the source. We have tasks setup in Bamboo which do such using native git.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top