Skip to content

Commit ab08fa7

Browse files
committed
param --autostash tutorial
1 parent 0c543b9 commit ab08fa7

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

README.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,33 @@ git pull --rebase = git fetch + git rebase
12011201

12021202
直接執行 `git rebase --abort` 即可回到之前的狀態。
12031203

1204+
額外補充小技巧,
1205+
1206+
* [Youtube Tutorial - git autostash 參數說明](https://youtu.be/kg2PyZr7l5k)
1207+
1208+
說明 `--autostash`,
1209+
1210+
一般來說, 如果我們工作到一半, 突然想要直接 `git pull --rebase`, 又不想 commit,
1211+
1212+
流程大約會像下面這樣
1213+
1214+
```cmd
1215+
git stash # 將目前的改動存進去 stash 中
1216+
git pull --rebase
1217+
git stash pop # 將之前的改動從 stash 中 pop 出來
1218+
# 如果有衝突再去解決衝突
1219+
```
1220+
1221+
但如果每次都要執行這麼多指令其實會有點煩:sweat:
1222+
1223+
但可以透過一個參數來解決, 也就是
1224+
1225+
`git pull --rebase --autostash`
1226+
1227+
以上這段指令基本上就是幫你執行了剛剛上面那一串的東西,
1228+
1229+
如果有衝突, 就再修正衝突即可:smile:
1230+
12041231
## git-cherry-pick
12051232

12061233
看影片會更清楚,手把手帶大家動手做 [Youtube Tutorial - git-cherry-pick](https://youtu.be/x3UtKUvlDdI)
@@ -1381,6 +1408,8 @@ git reset --hard HEAD
13811408

13821409
## git stash 指令
13831410

1411+
* [Youtube Tutorial - git stash 指令](https://youtu.be/CN065MNHtMY)
1412+
13841413
很多時候,我們正在開發一個新功能又或是 debug,然後突然有一個功能需要緊急修正,
13851414

13861415
但你又不想 commit 現在的狀況,因為根本沒意義,事情只做了一半,這時候 **stash**
@@ -1391,7 +1420,10 @@ git reset --hard HEAD
13911420

13921421
![alt tag](https://i.imgur.com/7xX0T1T.jpg)
13931422

1394-
然後,現在突然有一個bug必須馬上 ( 立刻 ) 處理,但是,啊我手上的事情還沒做完阿~~~~
1423+
然後,現在突然有一個 bug 必須馬上(立刻)處理,
1424+
1425+
但是,啊我手上的事情還沒做完阿~~~~
1426+
13951427
這時候,可以利用以下指令
13961428

13971429
```cmd

0 commit comments

Comments
 (0)