File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -579,6 +579,51 @@ git rebase 就是將 master 的最新 commit 接回來,再補上自己分支
579579
580580以上就是 git rebase 的介紹。
581581
582+ ## git pull 補充
583+
584+ 既然介紹完了 git fetch 以及 git rebase 之後,接下來我要再補充一些 git pull 額外的 options 參數
585+
586+ ``` cmd
587+ git pull [<options>] [<repository> [<refspec>…]]
588+ ```
589+
590+ 更多詳細指令可參考 [ https://git-scm.com/docs/git-pull#_options ] ( https://git-scm.com/docs/git-pull#_options ) 。
591+
592+ 這裡簡單整理一下,
593+
594+ ``` cmd
595+ git pull = git fetch + git merge
596+ git pull --rebase = git fetch + git rebase
597+ ```
598+
599+ 在 [ git-rebase] ( https://github.com/twtrubiks/Git-Tutorials#git-rebase ) 中已經讓大家了解到使用 git-rebase 可以讓 code review 的人
600+
601+ 看起來比較舒服,所以就使用 ` git pull --rebase ` 吧 ( 前提是你要知道你在幹嘛 :smile : )。
602+
603+ 這邊我模擬 git pull 以及 git pull --rebase 的差異,順便加上衝突的情況,因為步驟蠻多的,
604+
605+ 所以如果你想了解更多他的概念,請參考以下手把手教學,
606+
607+ [ git pull vs git pull --rebase] ( https://youtu.be/8h0K-2OaeSk )
608+
609+ 使用 git pull 後的結果,code review 的人一定翻桌 ( 如下圖 ):triumph :
610+
611+ 這邊我有順便模擬衝突的時候,你會發現如果使用 git pull 會多一個 commit (也就是下方的 "fix conflict")。
612+
613+ ![ alt tag] ( https://i.imgur.com/CNgKR3y.png )
614+
615+ 使用 git pull --rebase 後的結果,code review 的人表示溫馨 ( 如下圖 ):innocent :
616+
617+ 這邊我有順便模擬衝突的時候,你會發現如果使用 git pull --rebase 並不會像剛剛一樣多了一個 commit,
618+
619+ 原因是因為當我們使用 git pull --rebase 造成衝突時,修好衝突的內容之後,git add xxxx,接著我們會
620+
621+ 直接執行 git rebase --continue。
622+
623+ ![ alt tag] ( https://i.imgur.com/RKMo9ue.png )
624+
625+ 假設今天你執行了 git pull --rebase 之後,發現很難受 :fearful : ,想要取消,直接執行 ` git rebase --abort ` 即可回到之前的狀態。
626+
582627## git revert
583628
584629假設我 commit history 為 A1 -> A2 -> A3 -> A4 -> A5 -> A6
You can’t perform that action at this time.
0 commit comments