GIT使用规范
相关资料
git简易指南 http://www.ruanyifeng.com/blog/2012/07/git.html
git分支管理策略 http://rogerdudler.github.io/git-guide/index.zh.html
gitflow 工作流
点击这里查看gitflow图 http://nvie.com/img/git-model@2x.png
分支
- master 固定分支 (生产分支,tag做版本号)
- develop 固定分支 (开发分支,上线前合并代码,code review)
- feature 临时分支 (功能分支,每个项目一个分支)
- release 临时分支 (预发布分支)
- fixbug 临时分支 (修复BUG分支)
创建分支
git checkout -b feature-x develop
切换分支
git checkout feature-x
推送分支
git push origin feature-x
合并分支
git checkout develop
git merge --no-ff feature-x
注意: 合并分支一定要加上 --no-ff
命令
删除分支
git branch -d feature-x
git push origin :feature-x
给master打TAG
git checkout master
git tag -a 1.2
合并与冲突
合并
//切换到合并分支
git checkout develop
//合并目标分支 --no-ff
git merge --no-ff feature-x
冲突
撒销一个合并
//撤销一个本地的提交
git reset --hard HEAD
//撤销一个远程的提交
git reset --hard ORIG_HEAD