当前位置:   article > 正文

git clone 命令参数_git clone 参数

git clone 参数

自使用了git后,就彻底喜欢上了,深深体会到了自由的感觉,记录一些简单的笔记和使用心得,仅供留迹,以备后查。。。

git clone 命令参数:

usage: git clone [options] [–] [

]

-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
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

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

  1. 最简单直接的命令

git clone xxx.git

  1. 如果想clone到指定目录

git clone xxx.git “指定目录”

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

git clone -b [new_branch_name] xxx.git

  1. 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

但是本着点赞自愿,收藏吃灰,还是多少可以支持一下。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/883288
推荐阅读
相关标签
  

闽ICP备14008679号