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(其方式也 ...
随机推荐
- Google 宣布支持中文邮箱地址
Gmail 宣布,即日起开始支持非拉丁字符邮箱地址.也就是说,我们可以在 Gmail 中针对中文邮箱地址发送和接收邮件了. 全世界母语是拉丁字母语言的人类不超过全人类总数的一半,母语是英语的人数更少. ...
- pyqt5 笔记(三)py2exe 实现代码打包exe
python3.4 安装64位的版本 py2exe 下载地址: https://pypi.python.org/pypi/py2exe/0.9.2.0#downloads cmd——>进入pyf ...
- php的字符串处理
字符串处理: strlen("aaa");取字符串的长度 *** strcmp("aaa","aaa");比较两个字符串,相同的话输出0,不 ...
- 《Java实验四》
//实验4--附录一代码 public class PassValueTest { //静态代码块,类一加载就执行的部分. //所以运行这个程序会输出 class loding static { Sy ...
- spring六种种依赖注入方式
平常的java开发中,程序员在某个类中需要依赖其它类的方法,则通常是new一个依赖类再调用类实例的方法,这种开发存在的问题是new的类实例不好统一管理,spring提出了依赖注入的思想,即依赖类不由程 ...
- 获得servletContext的路径的方法
request.getSession().getServletContext().getRealPath("")或 System.getProperty("webapp. ...
- [转]dev C++编写windows程序遇到问题
1.工具-编译选项-编译器-在连接器命令行加入以下命令: -mwindows 2.出现错误:undefined reference to `PlaySoundA@12' 解决办法:工具-编译选项-编译 ...
- C++11 不抛异常的new operator
在google cpp style guide里面明确指出:we don't use exceptions C++11的noexcept关键字为这种选择提供了便利. C++11以前,提及malloc和 ...
- IP地址 子网掩码 默认网关 网络地址 广播地址
“IP地址”是“TCP/IP”(Transmite Control Protocol 传输控制协议/Internet Protocol网际协议)里其中的一种协议. Internet之所以能将广阔范围内 ...
- phpstom 实用laravel 需要附加的 命令
首先利用composer 下载相关的插件 在根目录执行此代码 composer require barryvdh/laravel-ide-helper 再者在config/app.php 添加一条命令 ...