Question

We use git to manage our code, and a CI system to build, copy and re-push the build artifacts back to git. We push to the master branch, the CI system pulls down the changes, builds, and pushes to a branch called production. That branch is then tested, and another CI task runs to pull down the production branch onto our live servers.

Nobody ever edits the version on the live servers in-place - the local copy of that repository is never changed, and it's cloned with the -b production modifier.

However, sometimes, when we pull down onto the live server, there are conflicts. I'm sure there's some problem with my understanding of git, but, if nothing changes on the server, and if it's pulling only from that branch, how can conflicts appear?

Our process is, essentially:

Locally:

git push origin master

CI:

git checkout <newest-changeset>

CI:

test
git checkout -b local # to put the detatched-head CHECKOUT from above into a usable branch
git push origin local:production

Server:

git pull origin production
--CONFLICT--
Was it helpful?

Solution

It looks like your process is lacking some structure around your change sets. I would not use arbitrary commits as a way to mark change-sets. Take a look at my branch-per-feature post to organize your work for CI http://dymitruk.com/blog/2012/02/05/branch-per-feature/.

In this way you can easily dedicate release candidate builds which can be promoted to production when you want and integration builds which is what you want on a frequent basis to get CI to run sanity tests as you develop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top