新建分支
$ git branch testing
切换到刚刚新建的分支
$ git checkout testing
做一些修改
$ vim test.rb
提交
$ git commit -a -m 'made other changes'
=========================================================================
假设此时项目需要修改,假设修改编号为 #iss53
新建 iss53分支并切换到此分支,注意 -b 参数
$ git checkout -b iss53
做一些修改
vim index.html
修改完成提交
$ git commit -a -m 'added a new footer [issue 53]'
对刚才的修改进行紧急合并
先切换到master
$ git checkout master
然后建立紧急修改分支并切换到此分支
git checkout -b 'hotfix'
做出与刚才 iss53一样的修改
vim index.html
提交修改
$ git commit -a -m 'fixed the broken email address'
再回到master
$ git checkout master
与 hotfix 合并分支合并,注意 git merge 语句为合并,本质是master指针后移
$ git merge hotfix
然后删掉合并分支 hotfix
$ git branch -d hotfix
现在可以回到 iss53 上继续推进
$ git checkout iss53
最后删掉 iss53
==================================================================================
分支的管理
查看有哪些分支
$ git branch
查看每个分支最后的更改
$ git branch -v
查看哪些分支已被并入当前分支
$ git branch --merged
查看尚未合并的工作
$ git branch --no-merged
git 的学习2
原创
©著作权归作者所有:来自51CTO博客作者RandTsui的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:git 的学习1
下一篇:asp.net 跨页面传值
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Git 学习记录 03
计算机新手的 git 学习记录
git 文件编辑器 版本控制系统 -
Git学习(2)创建版本库
什么是版本库呢?版本库又名仓库,英文名repository,你可以简单理解成一个目录,这个目
git 版本控制系统 git仓库 -
GIT学习笔记2--基本使用
一.便宜的本地分支 GIT让你可以拥有多个本地的分支,它们可能是完
Git 工作 git github git仓库 -
Git学习笔记-2.Git基本命令(本地)
如果想把文件从暂存区域移除,但仍然希望保留在当前工作目录中,换句话说,仅是从跟踪清单中删除,使用。为默认参数,用于重置暂
git 学习 github 暂存区 工作区 -
【Git】Git的使用与学习
在了解什么是分支前,先必须回顾Git如何保存数据:Git不保存差异,而是保存一系列文件快照。Git
git 学习 github 远程仓库 版本库 -
学习Git
Git的常用命令及远程管理等
常用命令 远程仓库 分支管理 标签管理