官方文档:https://git-scm.com/docs/git-clone
1 --depth<depth>
Create a shallow clone with a history truncated to the specified number of commits. Implies --single-branch
unless --no-single-branch
is given to fetch the histories near the tips of all branches. If you want to clone submodules shallowly, also pass --shallow-submodules
.
只克隆最近的一次commit
2 -b <name>
Instead of pointing the newly created HEAD to the branch pointed to by the cloned repository’s HEAD, point to <name>
branch instead. In a non-bare repository, this is the branch that will be checked out.--branch
can also take tags and detaches the HEAD at that commit in the resulting repository.
clone时某个<name>分支而不是默认Origin HEAD(master)