git clone命令使用

2021-08-15 07:07:17 字數 1839 閱讀 3568

git clone 命令引數:

usage: git clone [options] [--] 

-v, --verbose be more verbose

-q, --quiet be more quiet

--progress force progress reporting

-n, --no-checkout don't create a checkout

--bare create a bare repository

--mirror create a mirror repository (implies bare)

-l, --local to clone from a local repository

--no-hardlinks don't use local hardlinks, always copy

-s, --shared setup as shared repository

--recursive initialize submodules in the clone

--recurse-submodules initialize submodules in the clone

--template directory from which templates will be used

--reference reference repository

-o, --origin use instead of 'origin' to track upstream

-b, --branch

checkout

instead of the remote's head

-u, --upload-pack path to git-upload-pack on the remote

--depth create a shallow clone of that depth

--separate-git-dir separate git dir from working tree

-c, --config set config inside the new repository

引數挺多,但常用的就幾個:

1. 最簡單直接的命令

git clone ***.git

2. 如果想clone到指定目錄

git clone ***.git "指定目錄"

3. clone時建立新的分支替代預設origin head(master)

git clone -b [new_branch_name]  ***.git

4. clone 遠端分支

git clone 命令預設的只會建立master分支,如果你想clone指定的某一遠端分支(如:dev)的話,可以如下:

a. 檢視所有分支(包括隱藏的)  git branch -a 顯示所有分支,如:    

* master

remotes/origin/head -> origin/master

remotes/origin/dev

remotes/origin/master

b.  在本地新建同名的(「dev」)分支,並切換到該分支

git checkout -t origin/dev 該命令等同於:

git checkout -b dev origin/dev

Git clone命令使用詳解

usage git clone options v,verbose be more verbose q,quiet be more quiet progress force progress reporting n,no checkout don t create a checkout bare c...

git clone 命令引數

git clone 命令引數 usage git clone options v,verbose be more verbose q,quiet be more quiet progress force progress reporting n,no checkout don t create a ...

使用git clone命令轉殖檔案出現error

配製git 1 git config global user.name your name 2 git config global user.email email example.com 3 檢視配置是否生效 4 git config list 5 先在自己的linux伺服器本地生成ssh key...