命令行测试

[root@linux-node1 ~]# mkdir testing
[root@linux-node1 ~]#
[root@linux-node1 ~]# cd testing/
[root@linux-node1 testing]#
[root@linux-node1 testing]# git init
Initialized empty Git repository in /root/testing/.git/
[root@linux-node1 testing]# echo "" > index.html
[root@linux-node1 testing]# git add .
[root@linux-node1 testing]# git commit -m "first commit"
[master (root-commit) b712131] first commit
file changed, insertion(+)
create mode index.html
[root@linux-node1 testing]# echo "a file" > a.txt
[root@linux-node1 testing]# git add .
[root@linux-node1 testing]# git commit -m "add a.txt"
[master 025e8a3] add a.txt
file changed, insertion(+)
create mode a.txt
[root@linux-node1 testing]# echo "b file" > b.txt
[root@linux-node1 testing]# git add .
[root@linux-node1 testing]# git commit -m "add b.txt"
[master f4b13b6] add b.txt
file changed, insertion(+)
create mode b.txt
[root@linux-node1 testing]# git log
commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: +
add b.txt
commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: +
add a.txt
commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: +
first commit
[root@linux-node1 testing]# git checkout -b dev
Switched to a new branch 'dev'
[root@linux-node1 testing]# git status
On branch dev
nothing to commit, working directory clean
[root@linux-node1 testing]# git log
commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add b.txt commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add a.txt commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + first commit
[root@linux-node1 testing]# echo "welcome to beijing" > test1.txt
[root@linux-node1 testing]# git add .
[root@linux-node1 testing]# git commit -m "test1"
[dev d224e8c] test1
file changed, insertion(+)
create mode test1.txt
[root@linux-node1 testing]# echo "welcome to shanghai" > test2.txt
[root@linux-node1 testing]# git add .
[root@linux-node1 testing]# git commit -m "test2"
[dev e254dd5] test2
file changed, insertion(+)
create mode test2.txt
[root@linux-node1 testing]# git log
commit e254dd5657d99ed287faf62f74b566a7ac1bf858
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + test2 commit d224e8cb4a51a65377c8d8eb75c3613b197e47a4
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + test1 commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add b.txt commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add a.txt commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + first commit
[root@linux-node1 testing]# git checkout master
Switched to branch 'master'
[root@linux-node1 testing]# git status
On branch master
nothing to commit, working directory clean
[root@linux-node1 testing]# echo "master1" > master1.txt
[root@linux-node1 testing]# git add .
[root@linux-node1 testing]# git commit -m "master1"
[master 1ebe653] master1
file changed, insertion(+)
create mode master1.txt
[root@linux-node1 testing]# echo "master2" > master2.txt
[root@linux-node1 testing]# git add .
[root@linux-node1 testing]# git commit -m "master2"
[master 814b217] master2
file changed, insertion(+)
create mode master2.txt
[root@linux-node1 testing]# git log
commit 814b217ae84ca4ad541c36d96e9b3c2744bca849
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + master2 commit 1ebe65348f73958eeafce158f922d83e386faa78
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + master1 commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add b.txt commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add a.txt commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + first commit
[root@linux-node1 testing]# git merge dev
Merge made by the 'recursive' strategy.
test1.txt | +
test2.txt | +
files changed, insertions(+)
create mode test1.txt
create mode test2.txt
[root@linux-node1 testing]# git log
commit df1da42a6c93152001199d684f01702eb6cb622f
Merge: 814b217 e254dd5
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + Merge branch 'dev' commit 814b217ae84ca4ad541c36d96e9b3c2744bca849
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + master2 commit 1ebe65348f73958eeafce158f922d83e386faa78
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + master1 commit e254dd5657d99ed287faf62f74b566a7ac1bf858
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + test2 commit d224e8cb4a51a65377c8d8eb75c3613b197e47a4
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + test1 commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add b.txt commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + add a.txt commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@.com>
Date: Thu Dec :: + first commit

此时,整个分支合并图如下:

分支的状态会保留

如果使用git rebase dev,分支合并图如下:

分支的状态会清除

Gitlab+Jenkins学习之路(五)之git merge和git rebase的区别的更多相关文章

  1. Gitlab+Jenkins学习之路(一)之Git基础

    1.GIT基础    GIT是一个分布式版本管理系统,速度快,适合大规模,跨地区多人协同开.SVN是一个集中式版本管理系统. (1)GIT生态 GIT分布式版本管理系统 Gitlab git私库解决方 ...

  2. Gitlab+Jenkins学习之路(三)之gitlab权限管理--issue管理

    1.创建Group,User,Project 创建一个组,组名为java Group path http://192.168.56.11/java Visibility Level: #为权限级别,一 ...

  3. Gitlab+Jenkins学习之路(八)之发布maven项目及按版本发布

    一.什么是Maven maven是一个项目管理和综合工具.Maven提供给开发人员构建一个完整的生命周期框架. 开发团队可以自动完成该项目的基础设施建设,Maven使用标准的目录结构和默认构建生命周期 ...

  4. Gitlab+Jenkins学习之路(十一)之Jenkins自动触发构建和发布

    思路图: 一.下载gitlab plugin jenkins-->系统管理-->管理插件-->下载并安装gitlab plugin 二.配置gitlab认证 路径:Jenkins-- ...

  5. Gitlab+Jenkins学习之路(十三)之发布Java项目到tomcat

    一.新建一台虚拟机安装tomcat ()安装JDK 官网下载jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downl ...

  6. Gitlab+Jenkins学习之路(十四)之自动化脚本部署实践

    目录 一.环境说明和准备 1.环境说明 2.服务器准备工作 二.发布脚本编写 1.自动化部署流程设计 2.自动化部署脚本编写 三.发布测试 1.开发机和github添加ssh信任 2.克隆项目到开发机 ...

  7. Gitlab+Jenkins学习之路(四)之gitlab备份和恢复

    gitlab的备份和恢复 (1)创建备份目录,并授权 [root@linux-node1 ~]# mkdir /data/backups/gitlab -p [root@linux-node1 ~]# ...

  8. Gitlab+Jenkins学习之路(六)之Jenkins部署、升级和备份

    一.什么是持续集成? (1)Continuous integration(CI) 持续集成是一种软件开发实践,即团队开发成员经常集成他们的工作,通常每个成员至少集成一次,也就意味着每天可能会发生多次集 ...

  9. Gitlab+Jenkins学习之路(七)之发布PHP项目

    使用git+jenkins实现持续集成 Step1:构建一个自由风格的php-deploy Step2:Gernal配置,丢弃旧的构建,防止jenkins构建较多之后变臃肿 Step3:源码管理:这里 ...

随机推荐

  1. C# winform 只运行一个应用程序

    应用程序只有一个实例,当启动一次时创建实例,当多次启用时激活当前实例. 创建一个单利管理类 using Microsoft.VisualBasic.ApplicationServices; publi ...

  2. Oracle 补丁那些事儿(PS、PSU、CPU、SPU、BP、DBBP…)

    当前ORACLE数据库提供两种方式的补丁一种是主动的Proactive Patches和另一种被动的Reactive Patches,其中Reactive Patches是指过去的ONE-OFF Pa ...

  3. 使用开源库 MagicalRecord 操作 CoreData

    MagicalRecord  https://github.com/magicalpanda/MagicalRecord 注意:  MagicalRecord 在 ARC 下运作,Core Data ...

  4. 设置全局context变量 (显示用户登录名)

    比如在每个页面的最上面部分需要显示用户的登录名称,如果不登录则显示为Guest.这部分内容在每个页面都会出现,所以可将该部分内容作为一个公共模板(如userauth.html),如然后在其他模板中进行 ...

  5. RESTful 架构基础

    源自:https://mp.weixin.qq.com/s/wEr2jAVphzB1G_MISlLU0w REST(Representational State Transfer)架构风格是一种世界观 ...

  6. Linux系统安全最小原则

    系统安全最小原则 1.安装Linux系统最小化,选包最小化,不用就不安装2.开机服务最小化(5个)ssh network sysstat crontd rsyslog3.操作命令最小化  rm -rf ...

  7. RAC数据库的RMAN备份异机恢复到单节点数据库

    1.首先在rac环境用rman备份数据库.[oracle@rac1 admin]$ rman target /run{allocate channel c1 device type disk conn ...

  8. 1星|《社群X平台》:没有实际工作经验的职业写手拼凑而成

    社群X平台 赋能企业指数级增长 网站上介绍作者有一些身份.书中没提作者的职位,只介绍是“码字为生”.书的封底有一些名人言论的引用,咋一看以为都是推荐本书,细看只有最后李善友在推荐本书,其他人的话都是跟 ...

  9. September 25th 2017 Week 39th Monday

    No man is rich enough to buy back his own past. 没有人富有到可以赎回自己的过去. Those rich are not willing to buy b ...

  10. SDN上机第二次作业

    SDN第二次上机作业 1.安装floodlight 参考链接:http://www.sdnlab.com/19189.html 2.生成拓扑并连接控制器floodlight,利用控制器floodlig ...