打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Git clone 命令

Git clone 命令参数:

使用命令:git  clone -help

  1. $ git clone -help  
  2. usage: git clone [options] [--] <repo> [<dir>]  
  3.   
  4.     -v, --verbose         be more verbose  
  5.     -q, --quiet           be more quiet  
  6.     --progress            force progress reporting  
  7.     -n, --no-checkout     don't create a checkout  
  8.     --bare                create a bare repository  
  9.     --mirror              create a mirror repository (implies bare)  
  10.     -l, --local           to clone from a local repository  
  11.     --no-hardlinks        don't use local hardlinks, always copy  
  12.     -s, --shared          setup as shared repository  
  13.     --recursive           initialize submodules in the clone  
  14.     --recurse-submodules  initialize submodules in the clone  
  15.     --template <template-directory>  
  16.                           directory from which templates will be used  
  17.     --reference <repo>    reference repository  
  18.     -o, --origin <name>   use <name> instead of 'origin' to track upstream  
  19.     -b, --branch <branch>  
  20.                           checkout <branch> instead of the remote's HEAD  
  21.     -u, --upload-pack <path>  
  22.                           path to git-upload-pack on the remote  
  23.     --depth <depth>       create a shallow clone of that depth  
  24.     --single-branch       clone only one branch, HEAD or --branch  
  25.     --separate-git-dir <gitdir>  
  26.                           separate git dir from working tree  
  27.     -c, --config <key=value>  
  28.                           set config inside the new repository  



参数挺多,但常用的就几个:

1. 最简单直接的命令

git clone xxx.git

2. 如果想clone到指定目录

git clone xxx.git "指定目录"

3. clone时创建新的分支替代默认Origin HEAD(master)

git clone -b [new_branch_name]  xxx.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


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Git 如何 clone 非 master 分支的代码
Git的版本和分支管理
常用的git命令
git 命令创建本地分支,查看本地分支和切换本地分支
我所记录的git命令(非常实用)
git干货系列:(四)我要连接远程仓库(github,coding) | 嘟嘟独立博客
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服