git clone command parameters:
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
There are many parameters, but only a few are commonly used:
1. The simplest and most direct command
git clone xxx.git
2. If you want to clone to the specified directory
git clone xxx.git " specified directory "
3. Create a new branch to replace the default Origin HEAD (master) when clone
git clone -b [new_branch_name] xxx.git
4. clone remote branch
The git clone command will only create the master branch by default. If you want to clone a specified remote branch (eg: dev), you can do the following:
A. View all branches (including hidden ones) git branch -a shows all branches, such as:
* master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master
B. Create a new ("dev") branch with the same name locally and switch to this branch
git checkout -t origin/dev This command is equivalent to: git checkout -b dev origin/dev