亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Git應用進階(二)

發布時間:2020-07-13 18:40:31 來源:網絡 閱讀:319 作者:逐夢小濤 欄目:系統運維

Git進階(二)

===============================================================================

概述:


===============================================================================

Git 分支

1.分支命名法則及常用命令

master(主干分支) 是指向指定分支的最近一次提交;

dev 是指向dev分支的最近一次提交;

不管有多少分支,活動分支只能有一個;

head 一定是指向某個分支的,head表示? 映射了當前工作目錄當中所反映的最近一次提交;即 head始終指向活動分支的最近一次提交;

分支命名法則

  • 可以使用"/",但不能使用"/"結尾;

  • 不能以 "-" 開頭;

  • 以位于 "/" 后面的組件,不能以 "." 開頭;

  • 不能使用連續的 "...";

  • 不能使用空白字符" ";

  • 不能使用"^","~","?","*","[" 等符號

必須唯一,分支的名字始終指向目標分支的最近一次提交;

git branch :列出,創建及刪除分支

  • git branch BRANCH_NAME [START_COMMIT]

  • git branch? -d??BRANCH_NAME? 刪除分支

git show-branch:查看分支及其相關的提交

git? checkout?

  • git? checkout? <branch> 檢出分支

演示1:git 創建分支

[root@node1?test]#?ls
first.sh??INSTALL??readmin??subdir
[root@node1?test]#?git?branch?--list
*?master???#?帶"*"表示當前分支
[root@node1?test]#?git?log
commit?3c0b6864718ec8f8aebb5b66fbfd65b757504169?(HEAD?->?master)
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Mon?Aug?19?23:06:00?2019?+0800

????v0.0.2

commit?b0e9cc432d3adb683963686a2eec197129ef48b8
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Tue?Jul?16?23:26:38?2019?+0800

????v0.0.1
[root@node1?test]#?git?status
On?branch?master
Changes?to?be?committed:
??(use?"git?reset?HEAD?<file>..."?to?unstage)

	new?file:???first.sh

Untracked?files:
??(use?"git?add?<file>..."?to?include?in?what?will?be?committed)

	readmin

[root@node1?test]#?git?commit?-m?'v1.0'
[master?13051f2]?v1.0
?1?file?changed,?4?insertions(+)
?create?mode?100644?first.sh

[root@node1?test]#?git?status
On?branch?master
Untracked?files:
??(use?"git?add?<file>..."?to?include?in?what?will?be?committed)

	readmin

nothing?added?to?commit?but?untracked?files?present?(use?"git?add"?to?track)

[root@node1?test]#?git?ls-files?-s
100644?b6a56662e48ee60ef2d65fd2b00dd555e758b7fa?0	INSTALL
100644?1809e7ac283fd186a50d97b1462d2d27396f9b42?0	first.sh
100644?a4ec1ecd97368714ba8b5c8d002b1a24647bb7ec?0	subdir/1.txt

[root@node1?test]#?git?add?readmin
[root@node1?test]#?git?ls-files?-s
100644?b6a56662e48ee60ef2d65fd2b00dd555e758b7fa?0	INSTALL
100644?1809e7ac283fd186a50d97b1462d2d27396f9b42?0	first.sh
100644?8bf9463e75dfb20077fafb8358ee3cb471dd7900?0	readmin
100644?a4ec1ecd97368714ba8b5c8d002b1a24647bb7ec?0	subdir/1.txt

[root@node1?test]#?git?commit?-m?'v1.1'
[master?e522483]?v1.1
?1?file?changed,?1?insertion(+)
?create?mode?100644?readmin

[root@node1?test]#?git?log
commit?e522483313931f3dbc914ff6e132f5cd205f7d62?(HEAD?->?master)
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Wed?Aug?21?22:48:52?2019?+0800

????v1.1

commit?13051f2788b17981a72f641e6b30bc8bea0f2e38
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Wed?Aug?21?22:46:23?2019?+0800

????v1.0

commit?3c0b6864718ec8f8aebb5b66fbfd65b757504169
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Mon?Aug?19?23:06:00?2019?+0800

????v0.0.2

commit?b0e9cc432d3adb683963686a2eec197129ef48b8
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Tue?Jul?16?23:26:38?2019?+0800

????v0.0.1
[root@node1?test]#?git?branch
*?master

#?指明1.0版本創建分支
[root@node1?test]#?git?branch?dev?13051f
[root@node1?test]#?git?branch
??dev
*?master

[root@node1?test]#?git?branch?bug/first
[root@node1?test]#?git?branch
??bug/first
??dev
*?master

演示2:git show-branch? 查看分支

#??git?show-branch?查看具體的分支信息
[root@node1?test]#?git?show-branch
!?[bug/first]?v1.1
?!?[dev]?v1.0
??*?[master]?v1.1
---
+?*?[bug/first]?v1.1
++*?[dev]?v1.0


[root@node1?test]#?git?show-branch?dev
[dev]?v1.0
[root@node1?test]#?
[root@node1?test]#?git?show-branch?bug/first
[bug/first]?v1.1

演示3:git checkout BRANCH_NAME? 切換分支

[root@node1?taotao]#?git?checkout?dev??#切換分支
Switched?to?branch?'dev'
[root@node1?taotao]#?
[root@node1?taotao]#?git?branch?--list?
??bug/first
*?dev
??master
[root@node1?taotao]#?
[root@node1?taotao]#?git?show-branch
!?[bug/first]?v1.1
?*?[dev]?v1.0
??!?[master]?v1.1
---
+?+?[bug/first]?v1.1
+*+?[dev]?v1.0
[root@node1?taotao]#?
[root@node1?taotao]#?
[root@node1?taotao]#?git?log
commit?5d4298d6fdcbb6276e69f002e7148210124e52d9?(HEAD?->?dev)
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Wed?Oct?9?22:04:34?2019?+0800

????v1.0

commit?b9182448b3e9503ce5fd09edb5b378f612209d01
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Wed?Oct?9?21:05:05?2019?+0800

????v0.0.2

commit?1b5d8e0fea57e85045c8d98f12e379fdc73138bc
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Tue?Oct?8?21:24:06?2019?+0800

????v0.0.1
????
#############################
[root@node1?taotao]#?cat?first.sh
#!/bin/bash
echo?"hello?world"
echo?"new?date"
[root@node1?taotao]#?
[root@node1?taotao]#?git?status
On?branch?dev
Changes?not?staged?for?commit:
??(use?"git?add?<file>..."?to?update?what?will?be?committed)
??(use?"git?checkout?--?<file>..."?to?discard?changes?in?working?directory)

	modified:???first.sh

no?changes?added?to?commit?(use?"git?add"?and/or?"git?commit?-a")

[root@node1?taotao]#?git?add?first.sh
[root@node1?taotao]#?git?commit?-m?"v1.1-dev"??
[dev?587719d]?v1.1-dev
?1?file?changed,?1?insertion(+)
?
[root@node1?taotao]#?git?log
commit?587719dd3920429904c2b2a24637f20ecd20c4e0?(HEAD?->?dev)
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Fri?Oct?11?22:34:41?2019?+0800

????v1.1-dev

commit?5d4298d6fdcbb6276e69f002e7148210124e52d9
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Wed?Oct?9?22:04:34?2019?+0800

????v1.0

commit?b9182448b3e9503ce5fd09edb5b378f612209d01
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Wed?Oct?9?21:05:05?2019?+0800

????v0.0.2

commit?1b5d8e0fea57e85045c8d98f12e379fdc73138bc
Author:?watao?<wangzhangtao@pachiratech.com>
Date:???Tue?Oct?8?21:24:06?2019?+0800

????v0.0.1
????
[root@node1?taotao]#?cat?first.sh
#!/bin/bash
echo?"hello?world"
echo?"new?date"

#?切回主分支,再次查看first.sh,發現還是原來的,因為master分支并沒有提交新的操作
[root@node1?taotao]#?git?checkout?master
Switched?to?branch?'master'
[root@node1?taotao]#?
[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"

#?不被追蹤的文件在所有分支上都可以看見
[root@node1?taotao]#?git?checkout?dev
Switched?to?branch?'dev'
[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
[root@node1?taotao]#?
[root@node1?taotao]#?vim?second.sh
[root@node1?taotao]#?cat?second.sh?
#!/bin/bash
echo?"second.sh"
[root@node1?taotao]#?ls
first.sh??INSTALL??second.sh??subdir
[root@node1?taotao]#?
[root@node1?taotao]#?git?checkout?master
Switched?to?branch?'master'
[root@node1?taotao]#?
[root@node1?taotao]#?ls
first.sh??INSTALL??readmin??second.sh??subdir
[root@node1?taotao]#?cat?second.sh?
#!/bin/bash
echo?"second.sh"

#?添加到索引發現在所有分支上依然可以看見
[root@node1?taotao]#?git?add?second.sh
[root@node1?taotao]#?git?status
On?branch?master
Changes?to?be?committed:
??(use?"git?reset?HEAD?<file>..."?to?unstage)

	new?file:???second.sh

[root@node1?taotao]#?git?checkout?dev
A	second.sh
Switched?to?branch?'dev'
[root@node1?taotao]#?git?status
On?branch?dev
Changes?to?be?committed:
??(use?"git?reset?HEAD?<file>..."?to?unstage)

	new?file:???second.sh
	
#在dev分支上提交
[root@node1?taotao]#?git?commit?-m?"v1.1.1-dev"
[dev?21a0411]?v1.1.1-dev
?1?file?changed,?2?insertions(+)
?create?mode?100644?second.sh
[root@node1?taotao]#?git?status
On?branch?dev
nothing?to?commit,?working?tree?clean

#再次切回master分支,發現second.sh?已經沒有了
[root@node1?taotao]#?git?checkout?master
Switched?to?branch?'master'
[root@node1?taotao]#?ls
first.sh??INSTALL??readmin??subdir
[root@node1?taotao]#?git?status
On?branch?master
nothing?to?commit,?working?tree?clean

#在主分支創建一個second文件,然后切回dev分支報錯,因為和dev分支中已提交的second?發生沖突
[root@node1?taotao]#?echo?"#XIUXIU"?>?second.sh
[root@node1?taotao]#?git?status
On?branch?master
Untracked?files:
??(use?"git?add?<file>..."?to?include?in?what?will?be?committed)

	second.sh

nothing?added?to?commit?but?untracked?files?present?(use?"git?add"?to?track)
[root@node1?taotao]#?git?checkout?dev
error:?The?following?untracked?working?tree?files?would?be?overwritten?by?checkout:
second.sh
Please?move?or?remove?them?before?you?switch?branches.
Aborting
[root@node1?taotao]#?git?add?second.sh
[root@node1?taotao]#?git?checkout?dev
error:?Your?local?changes?to?the?following?files?would?be?overwritten?by?checkout:
second.sh
Please?commit?your?changes?or?stash?them?before?you?switch?branches.
Aborting
#刪除master主分支的second后,順利切換到dev分支
[root@node1?taotao]#?git?rm?-f?second.sh
rm?'second.sh'
[root@node1?taotao]#?git?checkout?dev
Switched?to?branch?'dev'
[root@node1?taotao]#?git?status
On?branch?dev
nothing?to?commit,?working?tree?clean
[root@node1?taotao]#?git?show-branch
!?[bug/first]?v1.1
?*?[dev]?v1.1.1-dev
??!?[master]?v1.1
---
?*??[dev]?v1.1.1-dev
?*??[dev^]?v1.1-dev
+?+?[bug/first]?v1.1
+*+?[dev~2]?v1.0
[root@node1?taotao]#?git?show-branch?--more=10
!?[bug/first]?v1.1
?*?[dev]?v1.1.1-dev
??!?[master]?v1.1
---
?*??[dev]?v1.1.1-dev
?*??[dev^]?v1.1-dev
+?+?[bug/first]?v1.1
+*+?[dev~2]?v1.0
+*+?[dev~3]?v0.0.2
+*+?[dev~4]?v0.0.1

演示4:git checkout -d BRANCH_NAME 刪除分支

[root@node1?taotao]#?git?branch?-d?bug/first?
Deleted?branch?bug/first?(was?5685269).
[root@node1?taotao]#?git?branch?--list
??dev
*?master

Git 分支合并

1.分支合并--git merge

相關概念

  • 合并基礎:要合并的分支的最近一次的共同提交;

  • 我們的版本:當前分支的最近一次提交;

  • 他們的版本要合并進來的分支的最近一次提交;

無沖突合并:

  1. git checkout master;? ?檢出到主分支

  2. git status???檢查是否有未提交的信息

  3. git merge BRANCH_NAME???從他們的版本合并到我們的版本

  4. git log --graph --pretty=oneline --abbrev-commit? ?以圖形的方式查看

有沖突合并:

  1. 手動解決沖突;

  2. 解決完成之后:git add ---> git commit

回退到合并之前的版本

  • git reset --hard ORIG_HEAD

演示1:無沖突的合并

[root@node1?taotao]#?git?branch?--list
??dev
*?master
[root@node1?taotao]#?
[root@node1?taotao]#?
[root@node1?taotao]#?git?merge?dev
Merge?made?by?the?'recursive'?strategy.
?first.sh??|?1?+
?second.sh?|?2?++
?2?files?changed,?3?insertions(+)
?create?mode?100644?second.sh
[root@node1?taotao]#?
[root@node1?taotao]#?git?status
On?branch?master
nothing?to?commit,?working?tree?clean
[root@node1?taotao]#?git?show-branch
!?[dev]?v1.1.1-dev
?*?[master]?Merge?branch?'dev'
--
?-?[master]?Merge?branch?'dev'
+*?[dev]?v1.1.1-dev
[root@node1?taotao]#?git?log?--graph?--pretty=oneline?--abbrev-commit
*???43d8e9a?(HEAD?->?master)?Merge?branch?'dev'
|\??
|?*?21a0411?(dev)?v1.1.1-dev
|?*?587719d?v1.1-dev
*?|?5685269?v1.1
|/??
*?5d4298d?v1.0
*?b918244?v0.0.2
*?1b5d8e0?v0.0.1

演示2:有沖突的合并

[root@node1?taotao]#?echo?"taotaohuihui"?>?my.txt
[root@node1?taotao]#?git?add?my.txt
[root@node1?taotao]#?git?commit?-m?"v2.0"
[master?1df3da7]?v2.0
?1?file?changed,?1?insertion(+)
?create?mode?100644?my.txt
?
?[root@node1?taotao]#?git?log?--graph?--pretty=oneline?--abbrev-commit
*?1df3da7?(HEAD?->?master)?v2.0???#?新創建的提交
*???43d8e9a?Merge?branch?'dev'
|\??
|?*?21a0411?(dev)?v1.1.1-dev
|?*?587719d?v1.1-dev
*?|?5685269?v1.1
|/??
*?5d4298d?v1.0
*?b918244?v0.0.2
*?1b5d8e0?v0.0.1
[root@node1?taotao]#?git?branch?dev
fatal:?A?branch?named?'dev'?already?exists.???#dev分支存在不能創建相同的,實際上可以刪除了,因為已經合并到master分支上去了
[root@node1?taotao]#?
[root@node1?taotao]#?
[root@node1?taotao]#?git?branch?fotfix???#?在master?2.0?的基礎上常見fotfix分支
[root@node1?taotao]#?git?show-branch
!?[dev]?v1.1.1-dev
?!?[fotfix]?v2.0
??*?[master]?v2.0
---
?+*?[fotfix]?v2.0
?--?[fotfix^]?Merge?branch?'dev'
++*?[dev]?v1.1.1-dev
[root@node1?taotao]#?echo?"third?line"?>>?first.sh???#?修改master分支的內容
[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
third?line
[root@node1?taotao]#?git?add?first.sh
[root@node1?taotao]#?git?commit?-m?"v2.1"
[master?697a6c5]?v2.1
?1?file?changed,?1?insertion(+)
[root@node1?taotao]#?git?show-branch
!?[dev]?v1.1.1-dev
?!?[fotfix]?v2.0
??*?[master]?v2.1
---
??*?[master]?v2.1
?+*?[fotfix]?v2.0
?--?[fotfix^]?Merge?branch?'dev'
++*?[dev]?v1.1.1-dev
[root@node1?taotao]#?git?checkout?fotfix??#切換到fotfix分支
Switched?to?branch?'fotfix'
[root@node1?taotao]#?ls
first.sh??INSTALL??my.txt??readmin??second.sh??subdir
[root@node1?taotao]#?
[root@node1?taotao]#?echo?"new?line"?>>?first.sh???#?編輯first文件并提交
[root@node1?taotao]#?cat?first.sh
#!/bin/bash
echo?"hello?world"
echo?"new?date"
new?line
[root@node1?taotao]#?git?add?first.sh
[root@node1?taotao]#?git?commit?-m?"v2.0-1"
[fotfix?26b42ef]?v2.0-1
?1?file?changed,?1?insertion(+)
?
?[root@node1?taotao]#?git?show-branch
!?[dev]?v1.1.1-dev
?*?[fotfix]?v2.0-1
??!?[master]?v2.1
---
?*??[fotfix]?v2.0-1
??+?[master]?v2.1
?*+?[fotfix^]?v2.0
?--?[fotfix~2]?Merge?branch?'dev'
+*+?[dev]?v1.1.1-dev
#?切回主分支,然后合并?fotfix分支,發現報錯,即內容發生沖突。需手動修復沖突后再合并
[root@node1?taotao]#?git?checkout?master
Switched?to?branch?'master'
[root@node1?taotao]#?
[root@node1?taotao]#?
[root@node1?taotao]#?git?merge?fotfix?
Auto-merging?first.sh
CONFLICT?(content):?Merge?conflict?in?first.sh
Automatic?merge?failed;?fix?conflicts?and?then?commit?the?result.
不能合并成功的文件,發現三個版本中?first.sh?內容各不相同
[root@node1?taotao]#?git?ls-files
INSTALL
first.sh
first.sh
first.sh
my.txt
readmin
second.sh
subdir/1.txt
[root@node1?taotao]#?
[root@node1?taotao]#?git?ls-files?--unmerged
100644?816a1b1e686cf6adb716b10e1a9eed870b2f18fa?1first.sh???#?"1"?表示合并基礎
100644?3adec3b3bf2616c52eaba36bd8af2e79e9ef6495?2first.sh???#?"2"?表示我們的版本
100644?e45ccd5a231f9debdd84ffd621cdc3acfc8d15f1?3first.sh???#?"3"?表示他們的版本
[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
<<<<<<<?HEAD
third?line
=======
new?line
>>>>>>>?fotfix
[root@node1?taotao]#?git?diff
diff?--cc?first.sh
index?3adec3b,e45ccd5..0000000
---?a/first.sh
+++?b/first.sh
@@@?-1,4?-1,4?+1,8?@@@
??#!/bin/bash
??echo?"hello?world"
??echo?"new?date"
++<<<<<<<?HEAD?????"<<<<"或">>>>>"為三方合并標記,由2個?++?開頭
?+third?line??#為主分支最近一次提交的內容
++=======
+?new?line
++>>>>>>>?fotfix??#為其他版本最近一次提交的內容
#直接在沖突文件的基礎上修改即可,如想要都保留的話就把"三方合并標記"給刪除
[root@node1?taotao]#?vim?first.sh?
[root@node1?taotao]#?git?diff
diff?--cc?first.sh
index?3adec3b,e45ccd5..0000000
---?a/first.sh
+++?b/first.sh
@@@?-1,4?-1,4?+1,5?@@@
??#!/bin/bash
??echo?"hello?world"
??echo?"new?date"
?+third?line??#新加的兩行
+?new?line
[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
third?line
new?line
#修改好之后重新添加到索引并提交
[root@node1?taotao]#?git?add?first.sh
[root@node1?taotao]#?git?commit??#出現內容提示,保存即可
[master?dd73764]?Merge?branch?'fotfix'
[root@node1?taotao]#?git?log?--graph?--pretty=oneline?--abbrev-commit
*???dd73764?(HEAD?->?master)?Merge?branch?'fotfix'
|\??
|?*?26b42ef?(fotfix)?v2.0-1
*?|?697a6c5?v2.1
|/??
*?1df3da7?v2.0
*???43d8e9a?Merge?branch?'dev'
|\??
|?*?21a0411?(dev)?v1.1.1-dev
|?*?587719d?v1.1-dev
*?|?5685269?v1.1
|/??
*?5d4298d?v1.0
*?b918244?v0.0.2
*?1b5d8e0?v0.0.1

演示3:回到合并之前的版本

#回到合并之前的版本
[root@node1?taotao]#?git?reset?--hard?ORIG_HEAD
HEAD?is?now?at?697a6c5?v2.1

[root@node1?taotao]#?git?log?--graph?--pretty=oneline?--abbrev-commit
*?697a6c5?(HEAD?->?master)?v2.1
*?1df3da7?v2.0
*???43d8e9a?Merge?branch?'dev'
|\??
|?*?21a0411?(dev)?v1.1.1-dev
|?*?587719d?v1.1-dev
*?|?5685269?v1.1
|/??
*?5d4298d?v1.0
*?b918244?v0.0.2
*?1b5d8e0?v0.0.1

[root@node1?taotao]#?git?show-branch
!?[dev]?v1.1.1-dev
?!?[fotfix]?v2.0-1
??*?[master]?v2.1
---
?+??[fotfix]?v2.0-1
??*?[master]?v2.1
?+*?[fotfix^]?v2.0
?--?[fotfix~2]?Merge?branch?'dev'
++*?[dev]?v1.1.1-dev

[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
third?line??#原來的文件還在

[root@node1?taotao]#?git?checkout?fotfix?
Switched?to?branch?'fotfix'
[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
new?line???#原來的文件還在

1.git變基分支合并--git rebase

變基操作

  • $ git checkout dev?: 首先切換到要變基的分支;

  • $ git rebase master: 把他的基從最近一次的共同祖先提交轉換為master的最新提交;

  • $ git checkout master :回到master分支;

  • $ git merge -m "MSG"?:master 獲取新的提交。

演示:

[root@node1?taotao]#?git?checkout?master
Switched?to?branch?'master'
[root@node1?taotao]#?ls
first.sh??INSTALL??my.txt??readmin??second.sh??subdir
[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
third?line
[root@node1?taotao]#?vim?first.sh?
[root@node1?taotao]#?cat?first.sh??#編輯文件先解決沖突,以便于演示git變基操作
#!/bin/bash
echo?"hello?world"
echo?"new?date"

#再次提交一次
[root@node1?taotao]#?git?add?first.sh
[root@node1?taotao]#?git?commit?-m?"v2.2"
[master?7961be2]?v2.2
?1?file?changed,?1?deletion(-)

?[root@node1?taotao]#?git?log?--graph?--pretty=oneline?--abbrev-commit
*?7961be2?(HEAD?->?master)?v2.2
*?697a6c5?v2.1
*?1df3da7?v2.0
*???43d8e9a?Merge?branch?'dev'
|\??
|?*?21a0411?(dev)?v1.1.1-dev
|?*?587719d?v1.1-dev
*?|?5685269?v1.1
|/??
*?5d4298d?v1.0
*?b918244?v0.0.2
*?1b5d8e0?v0.0.1

#切換到要變基的分支
[root@node1?taotao]#?git?checkout?fotfix
Switched?to?branch?'fotfix'
[root@node1?taotao]#?ls
first.sh??INSTALL??my.txt??readmin??second.sh??subdir

[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
new?line??#?新增加的一行

#執行變基操作,表示把當前?fotfix的基變為master分支的最近一次提交
[root@node1?taotao]#?git?rebase?master
First,?rewinding?head?to?replay?your?work?on?top?of?it...
Applying:?v2.0-1

[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
new?line

[root@node1?taotao]#?git?checkout?master
Switched?to?branch?'master'

[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"??#?此時沒有新行,需執行合并操作

[root@node1?taotao]#?git?merge?fotfix?
Updating?7961be2..3eaaead
Fast-forward?#?快進合并
?first.sh?|?1?+
?1?file?changed,?1?insertion(+)

?[root@node1?taotao]#?cat?first.sh?
#!/bin/bash
echo?"hello?world"
echo?"new?date"
new?line

[root@node1?taotao]#?git?log?--graph?--pretty=oneline?--abbrev-commit
*?3eaaead?(HEAD?->?master,?fotfix)?v2.0-1
*?7961be2?v2.2
*?697a6c5?v2.1
*?1df3da7?v2.0
*???43d8e9a?Merge?branch?'dev'
|\??
|?*?21a0411?(dev)?v1.1.1-dev
|?*?587719d?v1.1-dev
*?|?5685269?v1.1
|/??
*?5d4298d?v1.0
*?b918244?v0.0.2
*?1b5d8e0?v0.0.1








向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

镇宁| 宜川县| 墨竹工卡县| 伊宁县| 溧水县| 阜新市| 杂多县| 南召县| 荥阳市| 阿克苏市| 晋中市| 黑水县| 获嘉县| 库尔勒市| 北票市| 岑溪市| 仲巴县| 襄汾县| 明光市| 泰宁县| 徐闻县| 西林县| 宁乡县| 灌阳县| 古丈县| 靖安县| 二连浩特市| 太康县| 灌云县| 手游| 万宁市| 五大连池市| 青州市| 景东| 肥东县| 峨山| 安陆市| 额尔古纳市| 太白县| 太仓市| 綦江县|