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

原文:

http://blog.csdn.net/techbirds_bao/article/details/9179853

git之clone的更多相关文章

  1. visual studio2015从git上clone(克隆)项目

    本文介绍Visual Studio2015从git上clone项目代码的步骤. 1.打开VS2015,进到起始页,打开"团队资源管理器",如下图: 2.点击"克隆&quo ...

  2. 使用git svn clone迁移svn仓库

    使用git svn clone迁移svn仓库 clone命令可以指定很多参数,主要用到这些,你也可以使用git svn help查看完整的参数列表. git svn clone https://172 ...

  3. svn版本库包含多个项目 ; git svn clone; 某一个子项目,有多个分支;

    情况描述: 公司的svn版本库,包含了多个项目,每个项目对应于1个文件夹 假设版本库名字为Main,其下的项目用 A项目,对应文件夹A B项目,对应文件夹B 通过git svn clone获取了svn ...

  4. Git 如何 clone 非 master 分支的代码

    问题描述 我们每次使用命令 git clone git@gitlab.xxx.com:xxxxx.git 默认 clone 的是这个仓库的 master 分支.如果最新的代码不在 master 分支上 ...

  5. Git SVN Clone 旧项目迁移到 Git 上

    Git SVN Clone 旧项目迁移到 Git 上 很久使用的是 SVN,但由于项目重启,想改为 Git. 之前的 SVN 仓库是本地,所以在 git svn clone 一直不成功. 正确的方式: ...

  6. 使用git svn clone迁移svn仓库(保留提交记录)

    使用git svn clone迁移svn仓库 clone命令可以指定很多参数,主要用到这些,你也可以使用git svn help查看完整的参数列表. git svn clone https://172 ...

  7. git的clone和github的fork

    git的clone是从github上下载下来,clone到项目里面,fork是在本地修改后再提交到github上,在github上用request来进行提交,经作者确认后可以合同到mast分支上

  8. Ubuntu环境下使用npm编译从git上clone下来的前端(Javascript)项目

    一.更新Ubuntu软件源 打开终端依次输入: $ sudo apt-get update $ sudo apt-get install -y python-software-properties s ...

  9. 【CMake】CMake ERROR:could not find git for clone of

    在使用 CMake 构建VS2015项目时遇到一个错误提示:could not find git for clone of. 因为项目需要从GitHub导入运行库,但构建项目时提示未能找到这个库,而g ...

随机推荐

  1. Spring 手动获取request和response

    //获取responseHttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getReque ...

  2. 【leetcode刷题笔记】Wildcard Matching

    Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. ...

  3. Django---Blog系统开发之注册页面(验证码&ajax发送文件)

    前端页面及渲染: 静态文件的配置:setting.py: static 文件放在app下 STATIC_URL = '/static/' STATIC_ROOT = ( os.path.join(BA ...

  4. Guidelines for Successful SoC Verification in OVM/UVM

    By Moataz El-Metwally, Mentor Graphics Cairo Egypt Abstract : With the increasing adoption of OVM/UV ...

  5. Spring MVC 接收多个实体参数

    在SpringMVC 的接收参数中,如果接收一个实体对象,只需要在方法参数中这样做:@RequestBody User user //单个的时候这样接收 @RequestMapping(value = ...

  6. TCP的带宽估计和丢包恢复

    一.带宽估计 TCP的带宽估计主要通过拥塞控制算法实现,用到两个变量: 1.cwnd     TCP对当前链路可用带宽的估计 2.ssthreash   拥塞控制算法“假想”出来的可用带宽值 二.丢包 ...

  7. Qt QT的IO流 QT输入输出

    1. QFile QDataStream 读写文件  二进制读写文件 #include <QApplication> #include <QtGui> #include < ...

  8. mini6410基于linux2.6.36内核通过NFS启动根文件系统总结(一搭建开发环境——建立NFS服务器)

    http://blog.csdn.net/yinjiabin/article/details/7489030 建立 nfs 服务器 在嵌入式 linux 开发的时候,常常需要使用 nfs 以方便程序的 ...

  9. 0.00-050613_head.s

    # head.s contains the -bit startup code. # Two L3 task multitasking. The code of tasks are in kernel ...

  10. Codeforces 893E Counting Arrays:dp + 线性筛 + 分解质因数 + 组合数结论

    题目链接:http://codeforces.com/problemset/problem/893/E 题意: 共q组数据(q <= 10^5),每组数据给定x,y(x,y <= 10^6 ...