Skip to content

Commit c2889b2

Browse files
committed
update
1 parent 6a406e6 commit c2889b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+742
-174
lines changed

SUMMARY.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,21 @@
1212
* [Git 基礎]()
1313
* [Git 是什麼?](./git/foundation/what.md)
1414
* [為什麼我們需要 Git](./git/foundation/why.md)
15-
* [Git vs SVN](./git/foundation/git-vs-svn.md)
1615
* [初始化專案 init](./git/command/init.md)
1716
* [設定檔](./git/command/config.md)
18-
* [練習題:建立一個裸容器](./git/practice/init.md)
17+
* [練習題:init](./git/practice/init.md)
1918
* [觀念講解:索引](./git/foundation/index.md)
2019
* [觀念講解:認識 Git 物件](./git/foundation/object.md)
2120
* [Git 之 CRUD]()
2221
* [工作區、暫存區、儲存庫](./git/foundation/space.md)
2322
* [狀態 status](./git/command/status.md)
2423
* [新增 add](./git/command/add.md)
2524
* [送交 commit](./git/command/commit.md)
26-
* [練習題:新增一個送交紀錄](./git/practice/commit.md)
25+
* [練習題:commit](./git/practice/commit.md)
2726
* [檢視 log / show](./git/command/log.md)
2827
* [比對差異 diff](./git/command/diff.md)
2928
* [刪除 rm](./git/command/rm.md)
30-
* [練習題:刪除檔案](./git/practice/rm.md)
29+
* [練習題:rm](./git/practice/rm.md)
3130
* [重新命名 mv](./git/command/mv.md)
3231
* [觀念講解: Git Flow]()
3332
* [整體概念](./git/git-flow/README.md)
@@ -37,18 +36,20 @@
3736
* [分支 branch]()
3837
* [分支 branch CRUD](./git/command/branch.md)
3938
* [切換 checkout](./git/command/checkout.md)
40-
* [練習題:新增一個分支](./git/practice/branch.md)
39+
* [練習題:commit](./git/practice/checkout.md)
40+
* [練習題:branch](./git/practice/branch.md)
4141
* [合併 merge](./git/command/merge.md)
4242
* [觀念解說:解決衝突](./git/foundation/conflict.md)
43-
* [練習題:解決衝突](./git/practice/conflict.md)
43+
* [練習題:conflict 解決衝突](./git/practice/conflict.md)
4444
* [暫存 stash](./git/command/stash.md)
45-
* [練習題:將檔案放入暫存區](./git/practice/stash.md)
45+
* [練習題:stash](./git/practice/stash.md)
4646
* [修改送交]()
4747
* [還原 reset](./git/command/reset.md)
48+
* [練習題:reset](./git/practice/reset.md)
4849
* [資料還原 revert](./git/command/revert.md)
49-
* [(進階指令) rebase](./git/command/rebase.md)
50+
* [重新指定位置 rebase](./git/command/rebase.md)
51+
* [練習題:rebase](./git/practice/rebase.md)
5052
* [觀念講解:reset vs revert](./git/foundation/reset-vs-revert.md)
51-
* [練習題:還原狀態](./git/practice/reset.md)
5253
* [遠端協作]()
5354
* [容器](./git/foundation/container.md)
5455
* [remote](./git/command/remote.md)
@@ -57,7 +58,7 @@
5758
* [更新 fetch](./git/command/fetch.md)
5859
* [練習題:透過 fetch 指令取得最新送交紀錄](./git/practice/fetch.md)
5960
* [部署 push](./git/command/push.md)
60-
* [練習題:發佈送交](./git/practice/push.md)
61+
* [練習題:push](./git/practice/push.md)
6162
* [標籤 tag](./git/command/tag.md)
6263
* [練習題:發佈 tag](./git/practice/tag.md)
6364
* [Github](./git/github/README.md)
@@ -67,13 +68,15 @@
6768
* [pull request](./git/github/pr.md)
6869
* [練習題:操作 Github](./git/practice/github.md)
6970
* [補充]()
71+
* [reflog](./git/command/reflog.md)
7072
* [blame](./git/command/blame.md)
7173
* [grep](./git/command/grep.md)
7274
* [tig](./git/mise/tig.md)
7375
* [實用小技巧](./git/tips.md)
7476
* [更多資源](./git/resource.md)
7577

7678

79+
7780
<!--
7881
7982
- [初始 Git 專案](git/start/README.md)

git/.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"markdownTableFormatter.enable": true
3+
}

git/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Introduction
22

3-
### 講師
4-
5-
劉艾霖
3+
### 講師:劉艾霖 (alincode)
64

75
> 實務上的 Web Full Stack 開發經驗,熟悉 Java 以及 JavaScript 開發技術,專精於網站開發、架構設計與撰寫前後端自動化測試。是位全端工程師、後端工程師、測試開發工程師、企業內訓講師,具有 8 年軟體開發相關資歷,目前從事企業技術教學、技術顧問、軟體開發。
86

git/SUMMARY.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@
55
* [Git 基礎]()
66
* [Git 是什麼?](foundation/what.md)
77
* [為什麼我們需要 Git](foundation/why.md)
8-
* [Git vs SVN](foundation/git-vs-svn.md)
98
* [初始化專案 init](command/init.md)
109
* [設定檔](command/config.md)
11-
* [練習題:建立一個裸容器](practice/init.md)
10+
* [練習題:init](practice/init.md)
1211
* [觀念講解:索引](foundation/index.md)
1312
* [觀念講解:認識 Git 物件](foundation/object.md)
1413
* [Git 之 CRUD]()
1514
* [工作區、暫存區、儲存庫](foundation/space.md)
1615
* [狀態 status](command/status.md)
1716
* [新增 add](command/add.md)
1817
* [送交 commit](command/commit.md)
19-
* [練習題:新增一個送交紀錄](practice/commit.md)
18+
* [練習題:commit](practice/commit.md)
2019
* [檢視 log / show](command/log.md)
2120
* [比對差異 diff](command/diff.md)
2221
* [刪除 rm](command/rm.md)
23-
* [練習題:刪除檔案](practice/rm.md)
22+
* [練習題:rm](practice/rm.md)
2423
* [重新命名 mv](command/mv.md)
2524
* [觀念講解: Git Flow]()
2625
* [整體概念](git-flow/README.md)
@@ -30,18 +29,20 @@
3029
* [分支 branch]()
3130
* [分支 branch CRUD](command/branch.md)
3231
* [切換 checkout](command/checkout.md)
33-
* [練習題:新增一個分支](practice/branch.md)
32+
* [練習題:commit](practice/checkout.md)
33+
* [練習題:branch](practice/branch.md)
3434
* [合併 merge](command/merge.md)
3535
* [觀念解說:解決衝突](foundation/conflict.md)
36-
* [練習題:解決衝突](practice/conflict.md)
36+
* [練習題:conflict 解決衝突](practice/conflict.md)
3737
* [暫存 stash](command/stash.md)
38-
* [練習題:將檔案放入暫存區](practice/stash.md)
38+
* [練習題:stash](practice/stash.md)
3939
* [修改送交]()
4040
* [還原 reset](command/reset.md)
41+
* [練習題:reset](practice/reset.md)
4142
* [資料還原 revert](command/revert.md)
42-
* [(進階指令) rebase](command/rebase.md)
43+
* [重新指定位置 rebase](command/rebase.md)
44+
* [練習題:rebase](practice/rebase.md)
4345
* [觀念講解:reset vs revert](foundation/reset-vs-revert.md)
44-
* [練習題:還原狀態](practice/reset.md)
4546
* [遠端協作]()
4647
* [容器](foundation/container.md)
4748
* [remote](command/remote.md)
@@ -50,7 +51,7 @@
5051
* [更新 fetch](command/fetch.md)
5152
* [練習題:透過 fetch 指令取得最新送交紀錄](practice/fetch.md)
5253
* [部署 push](command/push.md)
53-
* [練習題:發佈送交](practice/push.md)
54+
* [練習題:push](practice/push.md)
5455
* [標籤 tag](command/tag.md)
5556
* [練習題:發佈 tag](practice/tag.md)
5657
* [Github](github/README.md)
@@ -60,6 +61,7 @@
6061
* [pull request](github/pr.md)
6162
* [練習題:操作 Github](practice/github.md)
6263
* [補充]()
64+
* [reflog](command/reflog.md)
6365
* [blame](command/blame.md)
6466
* [grep](command/grep.md)
6567
* [tig](mise/tig.md)

git/command/assets/git_blame.png

30.7 KB
Loading

git/command/assets/git_log.png

78.2 KB
Loading

git/command/assets/git_reset.png

89.7 KB
Loading

git/command/assets/git_reset2.png

142 KB
Loading

git/command/assets/git_show.png

75.7 KB
Loading

git/command/bisect.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Git Bisect 指令
22

3+
用二分搜尋法,找尋發生問題的 commit
4+
#### 使用情境
5+
6+
* 找尋發生問題的 commit
7+
38
```
49
git bisect start
510
git bisect bad

git/command/blame.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# git blame 指令
22

3+
![](assets/git_blame.png)
34
### 使用情境
45

56
* 追蹤 bug,查看這行程式誰的。

git/command/branch.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# git branch CRUD
22

3-
git branch --all ```
3+
![](https://git-scm.com/book/en/v2/images/topic-branches-1.png)
4+
[圖片來源 - git-scm.com](https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows)
5+
6+
git branch --all
7+
8+
```
49
* master
510
remotes/origin/HEAD -> origin/master
611
remotes/origin/master
712
```
813

14+
<!--
915
### 名稱
1016
1117
* 絕對名稱
@@ -15,7 +21,8 @@ git branch --all
1521
refs/head
1622
refs/remotes
1723
refs/tags
18-
```
24+
```
25+
-->
1926

2027
### 常用範例
2128

git/command/checkout.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ checkout 可用於將特定版本檔案取出,無論是資料夾或檔案皆
55
### 使用情境
66

77
* 切換分支
8-
* 發現檔案改錯,用git checkout filename把檔案還原到最新的版本
8+
* 透過 `git checkout -- README.md`,還原尚未 commit 的最新的變動
99
### 常用指令範例
1010

11-
| 範例 | 說明 |
12-
|--------------------------|-------------------------------|
13-
| git checkout README.md | 取出 README.md 檔案 |
14-
| git checkout docs/ | 取出特 docs 資料夾 |
15-
| git checkout dev | 取出 dev 分支 |
16-
| git checkout -b dev | 新增 dev 分支,並同時切換到 dev 分之上 |
17-
| git checkout README.md | 將 README.md 恢復到上一次 Commit 的狀態 |
11+
| 範例 | 說明 |
12+
|---------------------------|-------------------------------|
13+
| git checkout README.md | 取出 README.md 檔案 |
14+
| git checkout docs/ | 取出特 docs 資料夾 |
15+
| git checkout dev | 取出 dev 分支 |
16+
| git checkout -b dev | 新增 dev 分支,並同時切換到 dev 分之上 |
17+
| git checkout -- README.md | 將 README.md 恢復到上一次 Commit 的狀態 |
1818

1919
### 語法結構
2020

git/command/commit.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
### 常用範例
1212

13-
| 範例 | 說明 |
14-
|--------------------------------------|---------------------------|
15-
| git commit -m "commit message" | 新增一筆送交紀錄 |
16-
| git commit -a -m "commit message" | git add . + git commit -m |
17-
| git commit amend -m "修改成新的 message" | 改變最後一次提交紀錄 |
13+
| 範例 | 說明 |
14+
|---------------------------------------|---------------------------|
15+
| git commit -m "commit message" | 新增一筆送交紀錄 |
16+
| git commit -a -m "commit message" | git add . + git commit -m |
17+
| git commit --amend -m "修改成新的 message" | 改變最後一次提交紀錄 |
1818

1919
### 語法結構
2020

git/command/config.md

+17-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# 設定檔
22

3-
43
### 設定檔的位置
54

65
```
@@ -12,24 +11,30 @@ Config file location
1211

1312
* git config --global 的設定內容會被寫入 ~/.gitconfig
1413
* git config 的設定會被寫入 .git/config
14+
1515
### 編輯設定檔的方式
1616

1717
* `vi .git/config`
1818
* 使用 `git config` 指令
1919

20+
### 注意事項
21+
22+
* --global 參數比需要緊接著 git config
23+
2024
### 常用範例
2125

22-
| 範例 | 說明 |
23-
|-------------------------------------------------------------|------------|
24-
| git config l | 列出所有設定值 |
25-
| git config push.default matching | |
26-
| git config --global user.name "demo_user" | |
27-
| git config --global user.email "[email protected]" | |
28-
| git config --local user.name "demo_user" | 設定名稱 |
29-
| git config --local user.email "[email protected]" | 設定信箱 |
30-
| git config alias.tree "log --oneline --decorate --graph" | 設定 tree 暱稱 |
31-
| git config alias.l "log --all --decorate --graph --oneline" | 設定 l 暱稱 |
32-
| git config core.editor "vim" | 修改預設編輯器 |
26+
| 範例 | 說明 |
27+
|-------------------------------------------------------------|------------------|
28+
| git config l | 列出所有設定值 |
29+
| git config push.default matching | 預設發佈到相同分支名稱的遠端分支 |
30+
| git config --global user.name "demo_user" | |
31+
| git config --global user.email "[email protected]" | |
32+
| git config --local user.name "demo_user" | 設定名稱 |
33+
| git config --local user.email "[email protected]" | 設定信箱 |
34+
| git config alias.co "checkout" | 設定 checkout 暱稱 |
35+
| git config alias.tree "log --oneline --decorate --graph" | 設定 tree 暱稱 |
36+
| git config alias.l "log --all --decorate --graph --oneline" | 設定 l 暱稱 |
37+
| git config core.editor "vim" | 修改預設編輯器 |
3338

3439
### 推薦設定的 alias
3540

git/command/diff.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
| 範例 | 說明 |
1313
|--------------------------|------|
14-
| git diff --ours/--theirs | |
1514
| git diff | 比對差異 |
1615

16+
<!-- | git diff --ours/--theirs | | -->
17+
1718
### 語法結構
1819

1920
```

git/command/fetch.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# git fetch 指令
22

3-
執行 fetch,可以取得遠端數據庫的最新歷史記錄。取得的提交會導入在自動建立的分支中,並可以切換這個名為 FETCH_HEAD 的分支。
3+
執行 fetch,可以取得遠端 repo 的最新歷史記錄。取得的送交紀錄會導入在自動建立的分支中,並可以切換這個名為 FETCH_HEAD 的分支。
44

55
### 使用情境
66

7-
執行 pull,遠端數據庫的內容會自動合併。但是,有時候只是想確認遠端數據庫的內容卻不是真的想合併,在這種情況下,請使用 fetch。
7+
執行 pull,遠端 repo 的內容會自動合併。但是,有時候只是想確認遠端數據庫的內容卻不是真的想合併,在這種情況下,請使用 fetch。
88

99
### 常用指令範例
1010

git/command/grep.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### 使用情境
44

5-
* 快速查看送交紀錄
5+
* 快速內容有指定的關鍵字的檔案位置
66

77
### 常用範例
88

git/command/init.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# git init
22

3-
裸容器 (bare):一個沒有工作目錄的容器,目錄通常會取為 xxx.git
3+
裸容器 (bare):一個沒有工作目錄的容器,目錄通常會取名為 xxx.git
44

55
### 使用情境
66

77
* 初始化專案
88

99
### 常用範例
1010

11-
| 範例 | 說明 |
12-
|-----------------|--------|
13-
| git init | |
14-
| git init --bare | 初始化裸容器 |
11+
| 範例 | 說明 |
12+
|-----------------|---------|
13+
| git init | 初始化一般容器 |
14+
| git init --bare | 初始化裸容器 |
1515

1616

1717
### 語法結構

0 commit comments

Comments
 (0)