GIT使用规范

来源:互联网 发布:西安交通大学网络导航 编辑:程序博客网 时间:2024/06/06 04:12

GIT使用规范

相关资料

gitlab

gitflow 工作流

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

分支

  1. master 固定分支 (生产分支,tag做版本号)
  2. develop 固定分支 (开发分支,上线前合并代码,code review)
  3. feature 临时分支 (功能分支,每个项目一个分支)
  4. release 临时分支 (预发布分支)
  5. fixbug 临时分支 (修复BUG分支)

创建分支

git checkout -b feature-x develop

切换分支

git checkout feature-x

推送分支

git push origin feature-x

合并分支

git checkout developgit merge --no-ff feature-x

注意: 合并分支一定要加上 --no-ff 命令

删除分支

git branch -d feature-xgit push origin :feature-x

给master打TAG

git checkout mastergit tag -a 1.2

合并与冲突

合并

//切换到合并分支git checkout develop//合并目标分支 --no-ffgit merge --no-ff feature-x

冲突

撒销一个合并

//撤销一个本地的提交git reset --hard HEAD//撤销一个远程的提交          git reset --hard ORIG_HEAD
0 0
原创粉丝点击