Skip to content

Commit 0c543b9

Browse files
committed
git fetch --prune and branch
1 parent 647a229 commit 0c543b9

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,8 @@ git branch -D dev
520520

521521
那如果今天要刪除 remote 端的 branch 該怎麼辦呢:question:
522522

523+
* [Youtube Tutorial - git 刪除查看遠端的分支 branch](https://youtu.be/0JQrT7nfm_c)
524+
523525
```cmd
524526
git push origin --delete {remote_branch}
525527
```
@@ -598,6 +600,12 @@ git push -u origin v1
598600
git branch -r
599601
```
600602

603+
```cmd
604+
git branch --remote
605+
```
606+
607+
`--remote``-r` 都可以.
608+
601609
假設遠端有一個名稱為 develop 的分支,
602610

603611
我們只要 checkout 到該分支底下就可以了
@@ -653,6 +661,22 @@ git -C git_folder pull
653661

654662
這樣是不是清楚多了!!!
655663

664+
多補充一個參數 `--prune`,
665+
666+
* [Youtube Tutorial - git fetch 指令 prune 參數說明](https://youtu.be/ZMpMv1P1Q1Q)
667+
668+
這個主要的功能是刪除 remote 無效的 branch,
669+
670+
有時候明明已經把遠端的 branch 刪除, 但是你執行 `git branch --remote`,
671+
672+
卻會發現你還看的到那些 branch 的分支 (但明明網頁上的分支已經被移除了:sweat:)
673+
674+
常常會發生在 pull 端(非工作端)的機器 (如果不懂這句話的意思建議看影片說明:smile:)
675+
676+
這時候就可以同步一下本機和遠端的分支, 使用以下的指令
677+
678+
`git fetch --prune`
679+
656680
## git rebase
657681

658682
什麼是 rebase 呢 ? git rebase 就是避免多餘 ( 沒有意義 ) 的 merge !!! 先看看下面兩張圖
@@ -960,7 +984,7 @@ git rebase -i f0a761d
960984

961985
![alt tag](https://i.imgur.com/rgWkvVp.png)
962986

963-
( 如果你要合併多個,就多個都改成 s 或 squash )
987+
( 如果你要合併多個 commit,就多個都改成 s 或 squash, 注意, 有順序性:exclamation::exclamation: )
964988

965989
將著按下 ENTER,會看到下圖
966990

0 commit comments

Comments
 (0)