git clone

Posted 654321cc

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git clone相关的知识,希望对你有一定的参考价值。

 

官方文档: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)

  示例:https://www.cnblogs.com/nylcy/p/6569284.html

以上是关于git clone的主要内容,如果未能解决你的问题,请参考以下文章

git clone复制远程代码覆盖非空目录

如何git clone别人仓库的代码

【git】clone代码、ssh、权限问题

git小乌龟clone下来的文件不对

git clone从网络上拷贝一份源代码,过几天,想更新一下代码,如何操作?

Git 如何 clone 非 master 分支的代码