Git入门指南十一:Git branch 分支与合并分支
十五. Git branch 分支
查看当前有哪些branch
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch
* master
新建一个branch xm2.x
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch xm2.x
切换到一个branch
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git checkout xm2.x
新建并且切换到该branch,例: xm2.x
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git checkout -b xm2.x
再次查看
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch
* master
xm2.x
添加一个文件到你的repo
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git add bixiaopeng.txt
添加所有的文件 git add .
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git add .
commit一个文件
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git commit -m "bixiaopeng test case"
commit到本地
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git commit -a -m "xm2.x test case"
[xm2.x f78f430] xm2.x test case
39 files changed, 384 insertions(+)
create mode 100644 AndroidManifest.xml
………….
查看几次commit的区别
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git diff
将branch push到远程
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git push origin xm2.x
Counting objects: 78, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (77/77), 565.97 KiB, done.
Total 77 (delta 3), reused 0 (delta 0)
remote: To git@mirror.gitlab.*****.com:/home/git/repositories/xiaopeng.bxp/xmrobotium.git
remote: * [new branch] xm2.x -> xm2.x
To git@gitlab.****.com:xiaopeng.bxp/xmrobotium.git
* [new branch] xm2.x -> xm2.x
查看远程分支
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch -r
origin/master
origin/xm2.x
查看本地和远程分支
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch -a
master
* xm2.x
remotes/origin/master
remotes/origin/xm2.x
修改branch的名字
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch -m xm2.x test2.x
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch -r
origin/master
origin/xm2.x
查看本地和远程所有的分支
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch -a
master
* test2.x
remotes/origin/master
remotes/origin/xm2.x
删除远程分支
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git push origin --delete xm2.x
remote: To git@mirror.gitlab.****.com:/home/git/repositories/xiaopeng.bxp/xmrobotium.git
remote: - [deleted] xm2.x
To git@gitlab.*****.com:xiaopeng.bxp/xmrobotium.git
- [deleted] xm2.x
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch -r
origin/master
origin/test2.x
十六. Git 合并分支
首先切换到想要合并到的分枝下,运行'git merge’命令 (例如本例中将test2.x分支合并到xm3.0分支的话,进入xm3.0分支运行git merge test2.x命令)如果合并顺利的话:
确保当前分支为xm3.0
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git status
On branch xm3.0
nothing to commit, working directory clean
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch
master
test2.x
* xm3.0
bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git merge test2.x
Already up-to-date.
合并冲突处理:
Automatic merge failed; fix conflicts and then commit the result.
修改冲突的文件后,git add 文件 然后,git commit
Git入门指南十一:Git branch 分支与合并分支的更多相关文章
- 发布系统Git使用指南 - the Git Way to Use Git
发布系统Git使用指南 --the Git Way to Use Git 背景 有文章曾归纳,Git是一套内容寻址文件系统,意思是,Git的核心是存储键值对^[1]^.显然,这样的形式不利于普通人 ...
- svn 创建分支、切换分支 及 合并分支 操作
关联远程仓库: 右键 --- 点击 ' SVN Checkout...' 生成 打开trunk目录,在trunk目录下新建两个文本文件A.java,B.java: 打开A.java输入以下内容: ...
- 二、TortoiseSVN 合并、打分支、合并分支、切换分支
一.合并 点击Edit conflict来编辑冲突: 在合并后的枝干对应栏中编辑后,Save保存后关闭. 二.TortoiseSVN 打分支.合并分支.切换分支 1.SVN打分支 方式一:先检出,再打 ...
- idea实现svn拉分支和合并分支的教程
原文地址:https://blog.csdn.net/qq_27471405/article/details/78498260 今天测试了一下svn拉分支和合并分支的教程,决定分享给大家 拉分支教程: ...
- Git branch 分支与合并分支
Git branch 分支 查看当前有哪些branch bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch * master 新建一 ...
- Git入门指南九:远程仓库的使用【转】
转自:http://blog.csdn.net/wirelessqa/article/details/20152651 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 十三 ...
- [置顶] 【Git入门之十一】标签管理
原创作品,转载请标明:http://blog.csdn.net/jackystudio/article/details/12309731 标签是啥?标签就是给某个版本的一个标记. 1.为当前版本创建标 ...
- Git入门指南
git学习资源: Pro Git(中文版) Learn Git in your browser for free with Try Git. Git常用命令 Reference 常用 Git 命令清单 ...
- git入门手册:git的基本安装,本地库管理,远程上传
前言: git是分布式的版本库控制系统,它能方便你将自己的代码寄存于远程服务器上,从而实现集体合作开发.git有GUI 图形界面,然而使用终端命令仍是主流.以下基于Ubuntu系统操作git(其方式也 ...
随机推荐
- 阿里公共DNS 正式发布了
喜大普奔!集阿里巴巴集团众多优秀工程师开发维护的公共DNS---AliDNS终于上线啦!作为国内最大的互联网基础服务提供商,阿里巴巴在继承多年优秀技术的基础上,通过提供性能优异的公共DNS服务,为广大 ...
- SharePoint 2010 BCS - 简单实例(一)数据源添加
博客地址 http://blog.csdn.net/foxdave 本篇基于SharePoint 2010 Foundation. 我的数据库中有一个病人信息表Patient,现在我就想把这个表中的数 ...
- MVC5 烂笔头
HttpContent Controller:HttpContextBase View:HttpContext.Current View的搜寻顺序:本文件夹.本共享.根共享等 class=" ...
- RelativeLayout相对布局中拖放控件的办法
相对布局中拖了一个控件以后,要拖放第二个空间,死活拖不进去.仔细查看了鼠标的状况,发现要把第二个控件拖到第一个控件的周围,才能成功.果然是相对布局.
- iOS 7 教程:定制iOS 7中的导航栏和状态栏
目录(?)[-] iOS 7中默认的导航栏 设置导航栏的背景颜色 在导航栏中使用背景图片 定制返回按钮的颜 修改导航栏标题的字体 修改导航栏标题为图片 添加多个按钮 修改状态栏的风格 隐藏状态栏 总结 ...
- Android高薪之路-Android程序员面试宝典
Android高薪之路-Android程序员面试宝典
- 算法导论----VLSI芯片测试; n个手机中过半是好的,找出哪些是好手机
对于分治(Divide and Conquer)的题目,最重要是 1.如何将原问题分解为若干个子问题, 2.子问题中是所有的都需要求解,还是选择一部分子问题即可. 还有一点其实非常关键,但是往往会被忽 ...
- linux命令:pwd
1.介绍: pwd可以查看目录的完整路径,全称是Print Working Directory,. 2.命令格式 pwd [选项] 3.命令作用 查看目录的完整路径 4.常用选项 -L 当路径为链接路 ...
- MooFest_二维树状数组
Description Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",a s ...
- Median Weight Bead_floyd
Description There are N beads which of the same shape and size, but with different weights. N is an ...