国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務(wù)器之家 - 編程語言 - 編程技術(shù) - bug分支和feature分支_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

bug分支和feature分支_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

2022-02-13 19:17liaoxuefeng 編程技術(shù)

這篇文章主要介紹了bug分支和feature分支,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

軟件開發(fā)中,bug就像家常便飯一樣。有了bug就需要修復(fù),在Git中,由于分支是如此的強(qiáng)大,所以,每個(gè)bug都可以通過一個(gè)新的臨時(shí)分支來修復(fù),修復(fù)后,合并分支,然后將臨時(shí)分支刪除。

當(dāng)你接到一個(gè)修復(fù)一個(gè)代號(hào)101的bug的任務(wù)時(shí),很自然地,你想創(chuàng)建一個(gè)分支issue-101來修復(fù)它,但是,等等,當(dāng)前正在dev上進(jìn)行的工作還沒有提交:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
$ git status
# On branch dev
# Changes to be committed:
#  (use "git reset HEAD <file>..." to unstage)
#
#    new file:  hello.py
#
# 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:  readme.txt
#

并不是你不想提交,而是工作只進(jìn)行到一半,還沒法提交,預(yù)計(jì)完成還需1天時(shí)間。但是,必須在兩個(gè)小時(shí)內(nèi)修復(fù)該bug,怎么辦?

幸好,Git還提供了一個(gè)stash功能,可以把當(dāng)前工作現(xiàn)場(chǎng)“儲(chǔ)藏”起來,等以后恢復(fù)現(xiàn)場(chǎng)后繼續(xù)工作:

?
1
2
3
$ git stash
Saved working directory and index state WIP on dev: 6224937 add merge
HEAD is now at 6224937 add merge

現(xiàn)在,用git status查看工作區(qū),就是干凈的(除非有沒有被Git管理的文件),因此可以放心地創(chuàng)建分支來修復(fù)bug。

首先確定要在哪個(gè)分支上修復(fù)bug,假定需要在master分支上修復(fù),就從master創(chuàng)建臨時(shí)分支:

?
1
2
3
4
5
$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 6 commits.
$ git checkout -b issue-101
Switched to a new branch 'issue-101'

現(xiàn)在修復(fù)bug,需要把“Git is free software ...”改為“Git is a free software ...”,然后提交:

?
1
2
3
4
$ git add readme.txt
$ git commit -m "fix bug 101"
[issue-101 cc17032] fix bug 101
 1 file changed, 1 insertion(+), 1 deletion(-)

修復(fù)完成后,切換到master分支,并完成合并,最后刪除issue-101分支:

?
1
2
3
4
5
6
7
8
9
$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 2 commits.
$ git merge --no-ff -m "merged bug fix 101" issue-101
Merge made by the 'recursive' strategy.
 readme.txt |  2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git branch -d issue-101
Deleted branch issue-101 (was cc17032).

太棒了,原計(jì)劃兩個(gè)小時(shí)的bug修復(fù)只花了5分鐘!現(xiàn)在,是時(shí)候接著回到dev分支干活了!

?
1
2
3
4
5
$ git checkout dev
Switched to branch 'dev'
$ git status
# On branch dev
nothing to commit (working directory clean)

工作區(qū)是干凈的,剛才的工作現(xiàn)場(chǎng)存到哪去了?用git stash list命令看看:

?
1
2
$ git stash list
stash@{0}: WIP on dev: 6224937 add merge

工作現(xiàn)場(chǎng)還在,Git把stash內(nèi)容存在某個(gè)地方了,但是需要恢復(fù)一下,有兩個(gè)辦法:

一是用git stash apply恢復(fù),但是恢復(fù)后,stash內(nèi)容并不刪除,你需要用git stash drop來刪除;

另一種方式是用git stash pop,恢復(fù)的同時(shí)把stash內(nèi)容也刪了:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ git stash pop
# On branch dev
# Changes to be committed:
#  (use "git reset HEAD <file>..." to unstage)
#
#    new file:  hello.py
#
# 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:  readme.txt
#
Dropped refs/stash@{0} (f624f8e5f082f2df2bed8a4e09c12fd2943bdd40)

再用git stash list查看,就看不到任何stash內(nèi)容了:

?
1
$ git stash list

你可以多次stash,恢復(fù)的時(shí)候,先用git stash list查看,然后恢復(fù)指定的stash,用命令:

?
1
$ git stash apply stash@{0}

Feature分支

軟件開發(fā)中,總有無窮無盡的新的功能要不斷添加進(jìn)來。

添加一個(gè)新功能時(shí),你肯定不希望因?yàn)橐恍?shí)驗(yàn)性質(zhì)的代碼,把主分支搞亂了,所以,每添加一個(gè)新功能,最好新建一個(gè)feature分支,在上面開發(fā),完成后,合并,最后,刪除該feature分支。

現(xiàn)在,你終于接到了一個(gè)新任務(wù):開發(fā)代號(hào)為Vulcan的新功能,該功能計(jì)劃用于下一代星際飛船。

于是準(zhǔn)備開發(fā):

?
1
2
$ git checkout -b feature-vulcan
Switched to a new branch 'feature-vulcan'

5分鐘后,開發(fā)完畢:

?
1
2
3
4
5
6
7
8
9
10
11
12
$ git add vulcan.py
$ git status
# On branch feature-vulcan
# Changes to be committed:
#  (use "git reset HEAD <file>..." to unstage)
#
#    new file:  vulcan.py
#
$ git commit -m "add feature vulcan"
[feature-vulcan 756d4af] add feature vulcan
 1 file changed, 2 insertions(+)
 create mode 100644 vulcan.py

切回dev,準(zhǔn)備合并:

?
1
$ git checkout dev

一切順利的話,feature分支和bug分支是類似的,合并,然后刪除。

但是,就在此時(shí),接到上級(jí)命令,因經(jīng)費(fèi)不足,新功能必須取消!

雖然白干了,但是這個(gè)分支還是必須就地銷毀:

?
1
2
3
$ git branch -d feature-vulcan
error: The branch 'feature-vulcan' is not fully merged.
If you are sure you want to delete it, run 'git branch -D feature-vulcan'.

銷毀失敗。Git友情提醒,feature-vulcan分支還沒有被合并,如果刪除,將丟失掉修改,如果要強(qiáng)行刪除,需要使用命令git branch -D feature-vulcan。

現(xiàn)在我們強(qiáng)行刪除:

?
1
2
$ git branch -D feature-vulcan
Deleted branch feature-vulcan (was 756d4af).

終于刪除成功!

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 夜夜爽99久久国产综合精品女不卡 | 国产欧美精品一区二区三区四区 | 欧美福利网址 | 中文字幕91视频 | 色婷婷在线视频观看 | 日韩免费一区 | 日韩欧美一区二区中文字幕 | 日本精品一区二区三区视频 | 日韩a电影 | 亚洲成人一区二区三区 | 欧美一级毛片日韩一级 | 久久久久久久国产 | 亚洲免费视频在线 | 色站综合 | 国产美女一区 | 免费在线黄视频 | 自拍视频在线观看 | 国产中文字幕在线播放 | 久久69精品久久久久久国产越南 | 婷婷色av | 久久久成人av | 求av网址| 精品一区二区视频 | 中文字幕 亚洲一区 | 亚洲www视频 | 91精品国产九九九久久久亚洲 | 欧美日韩精品一区二区三区蜜桃 | 欧美日韩一区二区三区在线观看 | 国产福利精品一区 | 日本午夜精品 | 性色aⅴ免费视频 | 日本久久影视 | 午夜影院| 精品综合在线 | 欧美激情综合五月色丁香小说 | 一区二区中文字幕 | 日韩免费| 亚洲激情在线 | 日本人在线观看 | 国产亚洲精品精品国产亚洲综合 | 中文字幕在线观看1 |