2024-06-20|閱讀時間 ‧ 約 27 分鐘

C009|為什麼Git的世界博大精深?

今天學習Git Command-Line Syntax [1] 。


Git command的 convention 為:


`git [switches] <command> [<args>]`


而每一個部分的基本解釋是:


- `git` 是 Git 命令的開頭

- `[switches]` 是可選的選項,可以改變命令的行為

- `<command>` 是想執行的Git命令

- `[<args>]` 是命令的參數


其中常用的git command [2] 有:


add Add file contents to the index

bisect Find by binary search the change that introduced a bug

branch List, create, or delete branches

checkout Checkout a branch or paths to the working tree

clone Clone a repository into a new directory

commit Record changes to the repository

diff Show changes between commits, commit and working tree, etc

fetch Download objects and refs from another repository

grep Print lines matching a pattern

init Create empty git repository or reinitialize an existing one

log Show commit logs

merge Join two or more development histories together

mv Move or rename a file, a directory, or a symlink

pull Fetch from and merge another repository or a local branch

push Update remote refs along with associated objects

rebase Forward-port local commits to the updated upstream head

reset Reset current HEAD to the specified state

rm Remove files from the working tree and from the index

show Show various types of objects

status Show the working tree status

tag Create, list, delete or verify a tag object signed with GPG


而在官方文檔[3]有更完整的解釋。


此外,官方文檔對指令的大分類蠻有意思:


(1) 配置與設定 Setup and Config

(2) 取得和建立項目 Getting and Creating Projects [4]

(3) 基本快照 Basic Snapshotting [5]

(4) 分支與合併 Branching and Merging [6]

(5) 共享與更新項目 Sharing and Updating Projects [7]

(6) 檢查與比較 Inspection and Comparison [8]

(7) 打補丁 Patching

(8) 偵錯 Debugging

(9) 電子郵件 Email

(10) 外部系統 External Systems

(11) 行政 Administration

(12) 伺服器管理 Server Admin

(13) 關道命令 Plumbing Commands


感覺Git 的世界博大精深!要持續去學習。


Reference

[1] Section 3.2.1, https://www.manning.com/books/learn-git-in-a-month-of-lunches

[2] Listing 3.2, https://www.manning.com/books/learn-git-in-a-month-of-lunches

[3] https://git-scm.com/docs

[4] https://git.github.io/git-reference/creating/

[5] https://git.github.io/git-reference/basic/

[6] https://git.github.io/git-reference/branching/

[7] https://git.github.io/git-reference/remotes/

[8] https://git.github.io/git-reference/inspect/

分享至
成為作者繼續創作的動力吧!
從 Google News 追蹤更多 vocus 的最新精選內容從 Google News 追蹤更多 vocus 的最新精選內容

王啟樺的沙龍 的其他內容

你可能也想看

發表回應

成為會員 後即可發表留言
© 2024 vocus All rights reserved.