git clone 命令参数:

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

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

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

git分享(一)git clone的更多相关文章

  1. 分享 | Git常用的一些命令

    最近,各个项目团队已经全面从svn转向Git 近期将会分享一些Git的常用操作及使用经验: 先了解下工作中一些需要用到的命令: --------------------------- Git基本常用命 ...

  2. Androidstudio项目分享到Git@OSC托管

    Androidstudio项目分享到Git@OSC托管. 一.在OSC创建仓库 例如,创建一个AndroidStudy仓库,创建步骤如下: 输入仓库名称 点击创建按钮,就可以完成仓库的创建,如下图所示 ...

  3. 使用EGit插件将Eclipse现有项目分享到git@osc

    . . . . . 程序员一定要养成使用版本管理工具的好习惯,即使是自己一个人开发的项目也要加入到版本管理工具中.使用版本管理工具主要有两个好处:一个是更好的管理多个副本,这个优势不用说了:另一个就是 ...

  4. Git从码云Clone代码到本地

    Git从码云或者Github 克隆代码到本地 1.下载安装Git,傻瓜式下一步下一步即可... 2.配置Git: 2.1.选择你要clone到本地的路径:右键--->$ Git Bash Her ...

  5. git命令之git clone用法

    在使用git来进行版本控制时,为了得一个项目的拷贝(copy),我们需要知道这个项目仓库的地址(Git URL). Git能在许多协议下使用,所以Git URL可能以ssh://, http(s):/ ...

  6. Git 中 pull 和 clone 的区别

    git pull git clone clone 是本地没有 repository 时,将远程 repository 整个下载过来. pull 是本地有 repository 时,将远程 reposi ...

  7. git get submodule after clone

    /********************************************************************************* * git get submodu ...

  8. git第二节----git clone与git tag

    @git 远程克隆(clone)仓库,将远程工程clone到本地仓库:默认克隆远程master 分支 git clone  https://github.com/kaokaozhu/Test.git ...

  9. git clone、git pull和git fetch的用法及区别

    声明:码字不易,转载请注明出处,欢迎文章下方讨论交流.Git 常用命令速查表 最近在一个学习小组里学习AI的课程,我们所有的学习资料和homework都放在gitlab上.今天一个小队友从gitlab ...

随机推荐

  1. SQLSERVER新建表的时候页面分配情况是怎样的?

    SQLSERVER新建表的时候页面分配情况是怎样的? 再次感谢sqlskill网站和转载sqlskill网站文章并翻译的人,因为您们的转载和翻译让小弟又学习到新的东西o(∩_∩)o 文章中用到的工具: ...

  2. XCode升级导致的IAP失败的问题

    应用提交苹果测试之前,一般都会在沙盒环境里进行测试充值.用沙盒的测试帐号进行充值的时候,服务端拿到苹果返回的receipt-data后,向苹果服务端进行校验的时候,如果返回错误码21007则再去沙盒环 ...

  3. Sencha Toucha 2 —1.环境安装配置、在线打包、离线打包

    环境安装配置        1. 下载 1.1     Sencha Touch 下载 http://cdn.sencha.com/touch/sencha-touch-2.2.1-gpl.zip 1 ...

  4. 声色贴生成图片总结 Imagick

    2014-08-24 都是按以前的程序进行了,但去年8月都可以用Imagick正常生成CMYK的图片,但今天就是不行. 经过一切测试方法及思路,解决方法如下. 问题主要出现在: 生成的二维码是RGB格 ...

  5. 尝试制作了一个Panorama

    照片拍的不太好, 效果如下(浏览器需要支持WebGL), 您可以用鼠标拖动浏览:   //

  6. android:style.xml

    <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2006 The Andr ...

  7. 直接使用提交过来的类来更新字段EntityState.Modified并过滤null值的方法

    public T Update<T>(T entity) where T : ModelBase { var set = this.Set<T>(); set.Attach(e ...

  8. Ant自动编译打包&发布 android项目

    Eclipse用起来虽然方便,但是编译打包android项目还是比较慢,尤其将应用打包发布到各个渠道时,用Eclipse手动打包各种渠道包就有点不切实际了,这时候我们用到Ant帮我们自动编译打包了. ...

  9. Mac OS 下安装wget

    环境:  Mac OS X 10.9.4 1 下载源码 地址: http://ftp.gnu.org/gnu/wget/wget-1.9.tar.gz 2 解压安装 tar zxvf wget-1.9 ...

  10. Eclipse调试时Application XXX is waiting for the debugger to attach的提示

    原文链接: http://blog.csdn.net/star_huang/article/details/7678845 最近Eclipse调试时总是出现Application XXX  is wa ...