Distributed Development with Git and the Single Integrator (Part 1)
by Evin
On our recent project that Mike and I are working on, we are using Git and a highly defined process for development that is centered around a single integrator (me) and a team of developers that are geographically dispersed on a very complex application. We also have the trouble that the deployment server runs off of a code base that is stored in Subversion. We had to write a simple script that slaves a subversion repository to the changes that we make in Git. This is almost finished and we hope to tie it directly to pushes on the Git master branch.
Git Configuration
In order to do the single integrator process, you need to set up all the developers to have the same git config file. It should look something like this:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true [remote "origin"] url = evin@my.ip.address.to.git:/var/git/application.git fetch = +refs/heads/*:refs/remotes/origin/* push = +refs/heads/*:refs/remotes/evin/* [branch "master"] remote = origin merge = refs/heads/master
Obviously, replace “evin” with the user name of each of the developers. This configuration is accomplishing two things. One, it set it so that when the developer does a:
git pull origin master or git fetch origin master
That is pulls\fetches from the master branch. Two, when the developer is using his master branch or topic_branch, they will only push to a remote branch root with their username and doesn’t contaminate the master branch.
Daily Developer Process
Now, each of the individual developers then run the follow commands at the beginning of the day:
git checkout master git pull origin master
Then, the developer starts to work on each of their “topic_branches”:
git checkout topic_branch git rebase master
What this does is rewrite the history a little on the “topic_branch” to make the alignment correct for other changes that other developers made the day before. Once, this is done you might need to fix any merge errors to bring topic_branch current. Now, do the coding for the day on the “topic_branch”. Once the “topic_branch” has reached the point of integration with the master branch, do the following:
git push
Then, Email Integrator with: “Integrator, please merge evin/topic_branch”. Thats it for each of the developers…