複製 下載專案· Git | git download
在我們成功把我們的專案上傳到Github之後,就可以透過repoURL下載專案使用gitclone
在我們成功把我們的專案上傳到 Github 之後,就可以透過 repo URL 下載專案
使用 git clone <repo URL> 下載專案 $ git clone [email protected][1]:zlargon/git-test.git $ cd git-test $ git branch -a使用 git clone 的時候,git 預設會建立一個跟 project name 同名的資料夾(git-test)
用 git branch -a 檢視之後,發現有 1 個 local 分支和 3 個 remote 分支
Local Branch: master Remote Branch: remotes/origin/HEAD -> origin/master remotes/origin/bugFix remotes/origin/masterGit 預設的 remote 名稱為 origin(可以用 git remote rename 來修改名稱)
可是我們之前並沒有看過 remotes/origin/HEAD,這支個分支是什麼的呢?
remotes/origin/HEAD 是指專案的預設分支
而後面有一個箭頭指向 origin/master,表示專案的預設分支是 master
預設分支可以從 Github 的網頁介面去設定
若我們把它改成 bugFix
那麼 remotes/origin/HEAD 就會變成指向 origin/bugFix
使用 git clone <repo URL> -b <branch name> 指定分支若沒有指定分支的話,git 就會使用 "專案的預設分支" 去建 local branch
$ git clone [email protected][2]:zlargon/git-test.git -b bugFix 使用 git clone <repo URL> <...