命令行测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
[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 "123" > 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, 1 insertion(+)
 create mode 100644 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, 1 insertion(+)
 create mode 100644 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, 1 insertion(+)
 create mode 100644 b.txt
[root@linux-node1 testing]# git log
commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:36 2017 +0800
    add b.txt
commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:12 2017 +0800
    add a.txt
commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:21:35 2017 +0800
    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@163.com>
Date:   Thu Dec 21 14:22:36 2017 +0800
    add b.txt
commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:12 2017 +0800
    add a.txt
commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:21:35 2017 +0800
    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, 1 insertion(+)
 create mode 100644 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, 1 insertion(+)
 create mode 100644 test2.txt
[root@linux-node1 testing]# git log
commit e254dd5657d99ed287faf62f74b566a7ac1bf858
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:26:01 2017 +0800
    test2
commit d224e8cb4a51a65377c8d8eb75c3613b197e47a4
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:25:37 2017 +0800
    test1
commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:36 2017 +0800
    add b.txt
commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:12 2017 +0800
    add a.txt
commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:21:35 2017 +0800
    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, 1 insertion(+)
 create mode 100644 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, 1 insertion(+)
 create mode 100644 master2.txt
[root@linux-node1 testing]# git log
commit 814b217ae84ca4ad541c36d96e9b3c2744bca849
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:28:15 2017 +0800
    master2
commit 1ebe65348f73958eeafce158f922d83e386faa78
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:27:50 2017 +0800
    master1
commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:36 2017 +0800
    add b.txt
commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:12 2017 +0800
    add a.txt
commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:21:35 2017 +0800
    first commit
[root@linux-node1 testing]# git merge dev
Merge made by the 'recursive' strategy.
 test1.txt | 1 +
 test2.txt | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 test1.txt
 create mode 100644 test2.txt
[root@linux-node1 testing]# git log
commit df1da42a6c93152001199d684f01702eb6cb622f
Merge: 814b217 e254dd5
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:29:35 2017 +0800
    Merge branch 'dev'
commit 814b217ae84ca4ad541c36d96e9b3c2744bca849
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:28:15 2017 +0800
    master2
commit 1ebe65348f73958eeafce158f922d83e386faa78
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:27:50 2017 +0800
    master1
commit e254dd5657d99ed287faf62f74b566a7ac1bf858
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:26:01 2017 +0800
    test2
commit d224e8cb4a51a65377c8d8eb75c3613b197e47a4
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:25:37 2017 +0800
    test1
commit f4b13b6d3fc390eacb59e0d6223ac37329d96d6f
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:36 2017 +0800
    add b.txt
commit 025e8a337bfe312065d93b040852ceb532ef6642
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:22:12 2017 +0800
    add a.txt
commit b712131d81e3224f72f97c76f855e28da413450e
Author: xiaoming <xiaoming@163.com>
Date:   Thu Dec 21 14:21:35 2017 +0800
    first commit

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

分支的状态会保留

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

分支的状态会清除

版权声明:原创作品,谢绝转载。否则将追究法律责任
本文转自 IT_外卖小哥  51CTO博客,原文链接:http://blog.51cto.com/jinlong/2052922

自动化部署之git merge和git rebase的区别相关推荐

  1. git merge 和 git rebase详解

    git merge 和 git rebase 都是用来合并两个分支的. git merge b   #把b分支合并到当前分支 git rebase b   #把b分支合并到当前分支 --------- ...

  2. git(8)---git merge 和 git rebase 小结

    git merge 和 git rebase 小结 git merge是用来合并两个分支的. git merge b # 将b分支合并到当前分支 同样 git rebase b,也是把 b分支合并到当 ...

  3. git merge 和 git rebase的区别

    (1)git rebase 让你的提交记录更加清晰可读 git rebase 的使用 rebase 翻译为变基,他的作用和 merge 很相似,用于把一个分支的修改合并到当前分支上. 如下图所示,下图 ...

  4. git merge和git merge --no-ff有什么区别?

    本文翻译自:What is the difference between `git merge` and `git merge --no-ff`? Using gitk log , I could n ...

  5. git merge\git merge --no-commit\git merge --squash区别

    假设现有分支develop.test.需要将test合并到develop分支. 首先git checkout develop. git merge test test分支会合并到develop,会有t ...

  6. git merge 与 git rebase的区别

    转自:https://blog.csdn.net/liuxiaoheng1992/article/details/79108233 其实这个问题困扰我有一段时间,相信也有人和我一样有这个困扰,网上已有 ...

  7. git merge 和 git rebase 小结

    Git merge是用来合并两个分支的. git merge b # 将b分支合并到当前分支 同样 git rebase b,也是把 b分支合并到当前分支 ---------------------- ...

  8. [转]git merge 与 git rebase的区别

    git log --graph可以查看分支合并图 1>他们都是用于从一个分支获取并且合并到当前分支 2>一个场景:在feature分支进行新特性的开发,与此同时,master分支也有新的提 ...

  9. git merge squash 和 rebase 区别

    在合并分支的时候,默认是有三种选项的,分别是 普通的 merge squash merge rebase merge 普通 Merge 说到合并分支,可能我们最熟悉的操作是这样的: 先切换到目标分支: ...

最新文章

  1. java去重复的集合_如何去除Java中List集合中的重复数据
  2. 算法-有向环和拓扑排序
  3. [gic]-ARM gicv3/gicv4的详细介绍-2020/12
  4. 应用Java程序片段动态生成下拉列表
  5. HTML中form和div出现间隙以及页面居中的问题
  6. mysql缺少函数_Sqlserver的窗口函数的精彩应用之数据差距与数据岛-答案篇
  7. 美的摇头风扇FW40-8A摇头拉线断了修复方案
  8. 2020mysql安装教程_2020MySQL安装图文教程
  9. mysql 卡住_一次sql卡住的解决过程(mysql)
  10. 台式电脑如何重装系统windows10
  11. 昨晚做了个flash
  12. Process Kill Technology Process Protection Against In Linux
  13. c语言指针教学word,C语言中的指针和指针教学
  14. 黑苹果 efi如何替换_小白第一次安装黑苹果,然后卡代码,别着急,教你一个通用步骤,一个一个排查,大部分是可以解决的,毕竟安装不是最难的一个步骤...
  15. oracle怎么将数据删除文件,oracle删除数据文件
  16. linux脚本菜鸟教程,菜鸟教程之shell _1
  17. 惠普omen测试软件,惠普OMEN笔记本系统
  18. 快速打造 Android 自定义表情库
  19. matlab 矩阵累乘,matlab,SAS iml 矩阵运算
  20. 商户/服务商微信支付开发文档【 直连模式/服务商模式】如何在公众号、小程序中接入微信支付?

热门文章

  1. WEBBASE篇: 第六篇, CSS知识4
  2. 校赛热身 Problem C. Sometimes Naive (状压dp)
  3. 拷贝data/data/包名/files文件记下所有文件及文件夹到本地sdcard根目录teddyData_files文件夹下...
  4. 西安力邦智能医疗amp;可穿戴设备沙龙--第1期---苹果HealthKit、谷歌GoogleFit来袭,智能医疗要爆发吗?...
  5. [BuildRelease]Mozilla Build Tools(自动设置VC环境)
  6. 3DS MAX的灯光
  7. Windows性能计数器分析
  8. EnterpriseLibrary 介绍
  9. 深度学习---之bias
  10. java 对象equals_浅谈Java对象的equals方法