Google use Git P4, Critique and Rapid to maintain project release. We can also use Git, Gerrit and Jenkins to demo the simlar process.

Preparaion

Setup Gerrit

Setup Git

Setup Jenkins

java -jar jenkins.war --httpPort=1234

Branching strategy

All the branches are local branches, make sure the changes in dev/qa/master branches are correct before pushing to corresponding remote branches.

Remote tracking branches

dev: all points record features imlemetations or bug fixes

owner: anyone
rebase/merge changes from features branches or bug fix branches
need code review by Gerrit
submit to remote dev branch by Gerrit

qa: all points record release cut and bug fixes in qa demo

owner: release eng
merge changes in dev branch
cherry-pick dev commits(bug fixes)
don’t need code review, push to remote qa branch
each Jenkins

master: stable code version, push to prod

owner: release eng
merge changes in qa branch
tag only
don’t need code review, push to remote master branch

Other branches

features

personal maintain feature
create personal local branch
rebase/merge changes to dev branch
coorperate implementation feature
create remote branch in Gerrit
create remote tracking branch
merge changes to dev branch

hotfixes branches

owner: release eng
mater bug fix: changes merge to dev branch
qa bug fix: cherry pick changes in dev branch

Release Demo

Cut release
git checkout qa
git merge dev

Submit change to dev:
update code
git pull origin dev
git add <files>
git commit -m ‘new change’ (get commit id)
git push origin HEAD:refs/for/dev
once patch created, run unit test triggered by Jenkins
nightly build dev demo by Jenkins

Cherrypick to release
git checkcout qa
git cherrypick (commit id of bug fixes)
git push origin qa
once change merged in qa, run automation test triggerred by Jenkins
manually build qa demo by the latest merge/cherry-pick

Push to PROD
git checkout master
git merge qa
git push origin master
git tag -a ‘tag1.0’
git push origin tag1.0
manually build prod by the latest tag


↙↙↙阅读原文可查看相关链接,并与作者交流