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. Activiti 查看流程图

    package com.mycom.processDefinition; import java.io.File; import java.io.IOException; import java.io ...

  2. VS2015安装 Secondary Installer Setup Failed求解决方案

    个人同步本文博客地址http://aehyok.com/Blog/Detail/64.html 个人网站地址:aehyok.com QQ 技术群号:206058845,验证码为:aehyok 本文文章 ...

  3. Codeforces Round #379 (Div. 2) B. Anton and Digits 水题

    B. Anton and Digits 题目连接: http://codeforces.com/contest/734/problem/B Description Recently Anton fou ...

  4. NCPC 2013: Dance Reconstruction

    题目大意 对一个初始矩阵进行置换操作,已知经K次置换后得到的矩阵为,求一组可能的. 样例解释 这里只选取第二组样例进行解释. 4 2 3 4 1 2 2 3 4 1 初始矩阵为,根据Sample Ou ...

  5. SSD硬盘 全盘安全擦除

    此文From http://ssd.zol.com.cn/575/5753057.html 在SSD固态硬盘的使用过程中,部分用户可能会碰到计算机意外掉电或死机并强行断电后,系统出现异常,扫描SSD后 ...

  6. SQL Server如何启用xp_cmdshell组件

    [错误描述]: SQL Server阻止了对组件‘xp_cmdshell’的过程‘sys.xp_cmdshell’的访问.因为此组件已作为此服务嚣安全配置的一部分而被关闭.系统管理员可以通过使用sp_ ...

  7. Generating a new ASP.NET session in the current HTTPContext

    void regenerateId() { System.Web.SessionState.SessionIDManager manager = new System.Web.SessionState ...

  8. C#排序比较

    与C#定义了相等性比较规范一样,C#也定义了排序比较规范,以确定一个对象与另一个对象的先后顺序.排序规范如下 IComparable接口(包括IComparable接口和IComparable< ...

  9. iOS10 升级兼容必备参考

    最近提交审核不通过,再iOS10上运行崩溃 .然后需要处理崩溃的问题,晚上找了一下,整理收集起来. 方便后续查看使用. 以下参考链接特别有用: http://blog.csdn.net/gbking/ ...

  10. MySQL数据库从GBK转换到UTF-8最简单解决方案(也适用于其它编码转换)

    1.使用mysqldump导出表结构,如: mysqldump -d -u root -p 数据库名 >/root/struct.sql 2.使用mysqldump以特定编码导出数据(其中utf ...