git clone 命令参数:

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

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

1. 最简单直接的命令

  1. git clone xxx.git

2. 如果想clone到指定目录

  1. git clone xxx.git "指定目录"

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

  1. git clone -b [new_branch_name] xxx.git

4. clone 远程分支

  git clone 命令默认的只会建立master分支,如果你想clone指定的某一远程分支(如:dev)的话,可以如下:

  A. 查看所有分支(包括隐藏的)  git branch -a 显示所有分支,如:    

  1. * master
  2. remotes/origin/HEAD -> origin/master
  3. remotes/origin/dev
  4. remotes/origin/master

  B.  在本地新建同名的("dev")分支,并切换到该分支

  1. git checkout -t origin/dev 该命令等同于:
  2. 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. 微信小程序相关资料整理

    微信小程序官方介绍https://mp.weixin.qq.com/debug/wxadoc/introduction/index.html?t=201818 微信小程序开发资源https://jue ...

  2. python:字典的方法

    1.查找字典中的key对应的值和key是否存在(get,has_key)dict.get(key, default = None) :返回字典中key对应的值,若key不存在字典中,则返回defaul ...

  3. QT线程

    一.QObject子类 说明:以串口线程传输文件为例子,使用的是MoveTothread函数. void QObject::moveToThread(QThread *targetThread)可以将 ...

  4. MATLAB更换字体后 中文显示乱码问题

    MATLAB的脚本代码默认宋体显示,对于大多数720P的显示器来说,无论是中文还是英文,显示效果都非常差.Windows环境下,Consolas是一种比较理想的英文代码字体. Consolas 字体是 ...

  5. EF Code-First 学习之旅 继承策略

    Code First中有三种不同的方法表示继承层次关系 1.Table per Hierarchy (TPH): 这种方法建议用一个表来表示整个类的继承层次关系,表中包含一个识别列来区分继承类,在En ...

  6. 错误 1 类型“System.Web.Mvc.ModelClientValidationRule”同时存在于“c:\Progra型“System.Web.Mvc.ModelClientValidationRule”同时存在

    解决方案: step1:首先关闭你应用程序方案,在你保存项目的文件夹下找到ProjectName.csproj  ProjectName是你实际的应用程序名称. step2:用文字编辑器打开你找到它找 ...

  7. DL四(预处理:主成分分析与白化 Preprocessing PCA and Whitening )

    预处理:主成分分析与白化 Preprocessing:PCA and Whitening 一主成分分析 PCA 1.1 基本术语 主成分分析 Principal Components Analysis ...

  8. Spring boot 更改端口的几种方式

    web服务的默认端口是8080,但有时候我们需要更改成其他端口,这里有几种端口修改方式: 在application.properties文件添加配置(最简单) server.port= 在applic ...

  9. list添加map问题

    结论: list添加添加的是map的地址 List<Map<String, Object>> list = new ArrayList<>(); Map<St ...

  10. nova rebuild

    nova rebuild¶ usage: nova rebuild [--rebuild-password <rebuild-password>] [--poll] [--minimal] ...