[Git] An efficient GIT workflow for mid/long term projects
reference : http://fle.github.io/an-efficient-git-workflow-for-midlong-term-projects.html
Our full-web project has been going on for nearly two years and is running in production for over 18 months. I think it's my first project without any headache about our codebase and VCS management. So, I'll present our GIT workflow which has proven to be very effective for now.
Context
- Several developers
- Several staging/pre-production servers, several (non-synchronous) production servers
- Monthly releases (more or less) with delivery on staging, then on production servers
- On servers, basecode is directly pulled from the GIT repository with fabric
Rules
To handle this, we have set some simple rules:
- One (and only one) maintainer, who manage GIT repository and releases
- Never commit directly on master
- Never rebase master on any branch
- Do not get out of planned workflow
Workflow
Master branch
Our branch master is the common trunk and simply contains all the codebase of the next release. Since we don't work directly on it, it evolves mainly with merges.
Development branches
When a developer starts a new feature or a bugfix, he creates a new branch from master HEAD
$ (master) git checkout -b featureA
$ (featureA) git commit -a -m "featureA part 1"
$ (featureA) git commit -a -m "featureA part 2"
He follows branch master evolution and regularly ensures his code still works, by rebasing his branch featureA on branch master.
$ (featureA) git rebase master
When his developments are done (commits fa1 / fa2 in schema below), he does a last rebase. Thanks to this:
- he ensures that the maintainer will be able to merge easily (maintainer should not need to read code deeply and search why there are conflicts)
- if tests pass on development branch after rebase, they should pass on master after merge, so we ensure that branch ``master`` is always working well
Possibly, it will be the good time to clean the development branch to let it neat just when it is finished.
The maintainer can now merge this branch in master peacefully, without big conflict troubles. As the maintainer, I like to use no-ff option to force a merge commit, so history can stay really readable (we easily see where the branch has started and where it has been merged).
$ (master) git merge --no-ff featureA
Now that the branch has been merged, the developer should remove his development branch.
$ (master) git branch -d featureA
$ (master) git push origin :featureA
Stable branches
When we prepare a release, we update CHANGELOG (with our workflow, a git log --oneline should be quite clear to do that) and tag the branch master (optional), then we start a stable branch.
$ (master) git tag 1.0
$ (master) git checkout -b stable1.0
$ (stable1.0) git push origin stable1.0
This branch is deployed on different servers.
While development goes on, we possibly have to do some hotfixes (for example: commit hf1 in schema below), that must be sent in production quickly. These hotfixes are done directly on concerned stable branch.
Regularly, the maintainer merges stable branch in master to bring back these commits. This action is particularly important before the next release.
$ (master) git merge --no-ff stable1.0
We found this method really useful because:
- each stable branch has its own life and doesn't take care of branch master evolution, so we can hotfix stable branche freely and without stress
- we ensure that no hotfix commit has been lost before next release (avoid regressions)
A complete history example
Conclusion
Of course, there are several GIT workflows which can be very efficient, but we found many advantages in working with this method, and no real issue:
- Branch master is always clean and working well
- Developers don't care about GIT whole workflow
- We can fix stable branch without asking ourselves what happened on master since last release
- We ensure that each stable release contains new features and possible fixes
- Always working with branches and using``-no-ff``option make history really clear !
- This workflow is scalable (number of developers or branches doesn't really matter)
[Git] An efficient GIT workflow for mid/long term projects的更多相关文章
- git项目实战常用workflow和命令
一个从无到有的项目大体经历-创建项目目录,创建repo,配置过滤集,配置git user,导入已有基础代码入库,将库放到central去,建立分支,修改代码,checkin代码,分支上 测试验证代码, ...
- Git基本命令 -- 创建Git项目
在这里下载git:https://git-scm.com/ 安装的时候, 如果是windows系统的话, 可以勾选unix的命令行工具, 这样在windows命令行下会多出很多命令, 例如ls. Gi ...
- git push and git pull
原文链接 git push 通常对于一个本地的新建分支,例如git checkout -b develop, 在develop分支commit了代码之后,如果直接执行git push命令,develo ...
- git init和git init -bare区别
1 Git init 和 git init –bare 的区别 用"git init"初始化的版本库用户也可以在该目录下执行所有git方面的操作.但别的用户在将更新push上来的 ...
- 小丁带你走进git世界一-git简单配置
小丁带你走进git世界一-git简单配置 1.github的简单配置 配置提交代码的信息,例如是谁提交的代码之类的. git config –global user.name BattleHeaer ...
- Git(远程仓库:git@oschina)-V2.0
1.注册git@osc(也就是“码云”) 这里会提示注册密码==push密码,反正一定要记住的东西. 2.安装git 这里要设置个人信息 git config --list //查看git信息 g ...
- git pull和git fetch的区别
Git中从远程的分支获取最新的版本到本地有这样2个命令:1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge Git fetch origin master git log ...
- [.net 面向对象程序设计进阶] (26) 团队开发利器(五)分布式版本控制系统Git——图形化Git客户端工具TortoiseGit
[.net 面向对象程序设计进阶] (26) 团队开发利器(五)分布式版本控制系统Git——图形化Git客户端工具TortoiseGit 读前必备: 接上篇: 分布式版本控制系统Git——使用GitS ...
- Git:Git初体验——Git安装配置
作为即将成为一个程序员的男人,一直在听别人说Git多好多好,之前也随便了解了一些,但是始终没有决心去学会.现在大四了,只有毕设和一门开学六七周只去过一次课的全员必修课外,也没有什么事情做,何不去做这些 ...
随机推荐
- 【POJ】2069.Super Star
题解 求一个最小的半径的球,包括三维平面上所有的点,输出半径 随机移动球心,半径即为距离最远的点,移动的方式是向离的最远的那个点移动一点,之后模拟退火就好 代码 #include <iostre ...
- Java访问者模式
结构对象会遍历它自己所保存的聚集中的所有节点,在本系统中就是节点NodeA和NodeB.首先NodeA会被访问到,这个访问是由以下的操作组成的: (1)NodeA对象的接受方法accept()被调用, ...
- FPGA In/Out Delay Timing Constaint
先简单说说这段时间遇到的问题.FPGA采集前端scaler的视频数据.像素时钟(随路时钟),视频数据,行场同步,DE.这些信号进入FPGA后.通过CSC(颜色空间转换).输出后的图像有噪点.通过查看时 ...
- Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister报错解决办法
在做Hibernate框架数据库的关联关系映射练习中出现了Could not get constructor for org.hibernate.persister.entity.SingleTabl ...
- mysql索引之三:索引使用注意规则(索引失效--存在索引但不使用索引)*
使用索引时,有以下一些技巧和注意事项: (1)越小的数据类型通常更好:越小的数据类型通常在磁盘.内存和CPU缓存中都需要更少的空间,处理起来更快.(2)简单的数据类型更好:整型数据比起字符,处理开销更 ...
- 特殊字符导致jquery-mobile 挂起(firefox控制台报错 malformed URI sequence)
同事遇到一个问题,刷新页面导致页面挂起,浏览器控制台报错 malformed URI sequence, 经排查发现是引用jquery-mobile js引起的问题, 有一些中文参数在url中,当页面 ...
- OpenVAS漏洞扫描基础教程之连接OpenVAS服务
OpenVAS漏洞扫描基础教程之连接OpenVAS服务 连接OpenVAS服务 当用户将OpenVAS工具安装并配置完后,用户即可使用不同的客户端连接该服务器.然后,对目标主机实施漏洞扫描.在本教程中 ...
- django信号调度的用法
Django中提供了"信号调度",用于在框架执行操作时解耦. 一些动作发生的时候,系统会根据信号定义的函数执行相应的操作 Django中内置的signal Model_signal ...
- 【BFS】【最小生成树】Petrozavodsk Winter Training Camp 2018 Day 1: Jagiellonian U Contest, Tuesday, January 30, 2018 Problem G. We Need More Managers!
题意:给你n个点,点带权,任意两点之间的边权是它们的点权的异或值中“1”的个数,问你该图的最小生成树. 看似是个完全图,实际上有很多边是废的.类似……卡诺图的思想?从读入的点出发BFS,每次只到改变它 ...
- iptables配置允许mysql远程访问
vi /etc/sysconfig/iptables iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCE ...