Search code examples
gitdeploymentgithubgit-workflow

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


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.


Solution

  • 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.