git指定初始化的 branch 名稱
git init 就支援直接指定初始化的 branch 名稱。用法如下:
git init -b <branch-name>
例如,如果你想在初始化時就用 main 作為預設分支:
git init -b main
git init 會固定建立 master 分支,無法直接指定。main,可以透過設定全域配置來改變預設行為:git config --global init.defaultBranch main
這樣以後執行 git init(不加 -b)時,會自動建立 main 分支。
| File14 | File | Last Modified |
|---|---|---|
| git內部完全刪除一個檔案 | git內部完全刪除一個檔案 | 1:24 AM - December 07, 2025 |
| github上的repo clone下來check out 某一個dev branch | github上的repo clone下來check out 某一個dev branch | 1:24 AM - December 07, 2025 |
| github一台電腦同時使用兩個 GitHub 帳號 | github一台電腦同時使用兩個 GitHub 帳號 | 1:24 AM - December 07, 2025 |
| github actions | github actions | 1:24 AM - December 07, 2025 |
| git 重新再從github上pull 所有branch | git 重新再從github上pull 所有branch | 1:24 AM - December 07, 2025 |
| git 恢復到最近一次 git pull狀態,取消本地修改 | git 恢復到最近一次 git pull狀態,取消本地修改 | 1:24 AM - December 07, 2025 |
| git 初始化與推送流程圖 | git 初始化與推送流程圖 | 1:24 AM - December 07, 2025 |
| git 中查看commit歷史資訊 | git 中查看commit歷史資訊 | 1:24 AM - December 07, 2025 |
| git 中修改檔名且保留原來commit紀錄 | git 中修改檔名且保留原來commit紀錄 | 1:24 AM - December 07, 2025 |
| git Remote 常見情境與操作 | git Remote 常見情境與操作 | 1:24 AM - December 07, 2025 |
| git GUI tool, SourceTree | git GUI tool, SourceTree | 1:23 AM - December 07, 2025 |
| 把目前repo 所有的branch都push 到github | 把目前repo 所有的branch都push 到github | 8:20 PM - December 06, 2025 |
| 把目前 branch 上的修改(尚未 commit 的檔案)直接帶到一個新的 branch | 把目前 branch 上的修改(尚未 commit 的檔案)直接帶到一個新的 branch | 8:20 PM - December 06, 2025 |
| 從 Windows 把 repo 搬到 WSL再一次性 push 所有 branch 到GitHub 這樣就能避開 aux 檔名問題 | 從 Windows 把 repo 搬到 WSL再一次性 push 所有 branch 到GitHub 這樣就能避開 aux 檔名問題 | 8:20 PM - December 06, 2025 |