git --version | : 查看 Git 版本。 |
git clone <儲存網址> | : 複製儲存內容。 |
git config --list | : 列出 config 的內容。 |
git config --list --show-origin | : 列出所有 config 的檔案及內容。 |
git config --global user.name "John Doe" | : 設定使用者名稱為"John Doe"。 |
git config user.name | : 查看 config 中 user.name 的值。 |
git config --global user.email johndoe@example.com | : 設定使用者 email 為 johndoe@example.com。 |
git config --global core.editor emacs | : 設定要使用的文字編輯器為 emacs。 |
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" | : 設定 Notepad++ 為要使用的文字編輯器。 |
git config --show-origin rerere.autoUpdate | : 查看 config 中 rerere.autoUpdate 的值是來自哪一個檔案。 |
git help <verb> | : 列出 <verb> 的說明網頁 |
git help config | : 列出 config 的說明網頁 |
git init | : 啟動所在資料夾的 git 管控功能 |
git add <file>... | : 將檔案加入 git 管控 |
git checkout -- <file>... | 撤銷檔案的變更 |
git commit -m '註解內容' | : 將變更簽入並加上註解 |
git commit --amend | : 修正變更簽入內容 |
git clone 網址 | : 下載一個既存的 git repository |
git <verb> --help | : 列出 <verb> 的說明網頁 |
git help config | : 列出 config 的說明網頁 |
git add -h | : 列出 add 的簡要說明 |
git add *.c | :加入現有的 c 程式檔 |
git add LICENSE | :加入 LICENSE 這個檔案 |
git clone https://github.com/tester/projectname | :從 github 複製一個專案 |
git clone https://github.com/tester/projectname dirname | :從 github 複製一個專案到指定的目錄 |
git status | : 查看目前 git 狀態 |
git status -s | : 查看目前 git 狀態,只顯示簡單訊息 |
git reset HEAD <file>... | unstage 檔案 |
git diff | 列出有異動的部份 |
git diff --staged | 列出目前 stage 與上次 commit 的狀態異動 |
git diff --cached | 列出目前已經放入 stage 的狀態 |
git difftool | 用來工具程式顯示異動內容 |
git difftool --tool-help | 顯示目前系統中有那些 difftool可用 |
git rm <file> | : 移除 <file> |
git rm --cached <file> | 撤回某個已經 commit 的檔案 |
git rm log/\*.log | 移除 log 目錄下所有的 log 檔 |
git rm \*~ | 移除所有檔名以~結尾的檔案 |
git mv <file_from> <file_to> | 將 <file_from> 的內容遷移到 <file_to> |
git reset HEAD <file>..." | 將檔案恢復成 unstage 狀態 |
git log | 顯示變更紀錄 |
git log -p | 顯示變更詳細紀錄 |
git log --patch | 顯示變更詳細紀錄 |
git log -2 | 只顯示最後2筆變更紀錄 |
git log --stat | 顯示變更紀錄統計資料 |
git log --oneline | 將每次的變更紀錄顯示成一行 |
git log --pretty | 格式化顯示變更紀錄資料 |
git log --pretty=short | 將變更紀錄以最簡短的方式顯示 |
git log --pretty=full | 將變更紀錄以簡短的方式顯示 |
git log --pretty=fuller | 將變更紀錄以稍完整的簡短方式顯示 |
git log --pretty=format:"%h - %an, %ar : %s" | 將變更紀錄以 hash - Author name, relative date : Subject 的格式顯示 |
git log --pretty=format:"%h %s" --graph | 將變更紀錄以 hash Subject 的格式用 ASCII 顯示 |
git log --since=2.weeks | 顯示兩週以來的變更 |
git log -S function_name | 只顯示有變更 function_name 內容的紀錄 |
| |
| |
| |
| |
man gitignore | : 列出 <gitignore> 的說明網頁 |
man git-<verb> | : 列出 <verb> 的說明網頁 |
| |