it clone 命令參數:git
usage: git clone [options] [--] <repo> [<dir>] -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 <template-directory> directory from which templates will be used --reference <repo> reference repository -o, --origin <name> use <name> instead of 'origin' to track upstream -b, --branch <branch> checkout <branch> instead of the remote's HEAD -u, --upload-pack <path> path to git-upload-pack on the remote --depth <depth> create a shallow clone of that depth --separate-git-dir <gitdir> separate git dir from working tree -c, --config <key=value> set config inside the new repository
參數挺多,但經常使用的就幾個:ide
1. 最簡單直接的命令ui
git clone xxx.git
2. 若是想clone到指定目錄spa
git clone xxx.git "指定目錄"
3. clone時建立新的分支替代默認Origin HEAD(master)code
git clone -b [new_branch_name] xxx.git
4. clone 遠程分支blog
git clone 命令默認的只會創建master分支,若是你想clone指定的某一遠程分支(如:dev)的話,能夠以下:rem
A. 查看全部分支(包括隱藏的) git branch -a 顯示全部分支,如: get
* master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master
B. 在本地新建同名的("dev")分支,並切換到該分支it
git checkout -t origin/dev 該命令等同於: git checkout -b dev origin/dev