gbs 克隆

名称

gbs-clone - 克隆一个Git仓库到一个新的目录

简介

gbs clone [-h] [--upstream-branch <Upstream_Branch>]
          [--packaging-branch <Working_Branch>]
          [--all] [--depth <Depth>] <Repository> [<Directory>]

描述

此命令克隆一个仓库到一个新创建的目录。 当使用不同的参数执行该命令时,gbs-clone使用户能够执行下面的操作:

  • 指定上游分支和工作分支。
  • 跟踪所有远程分支。
  • 创建一个具有特定深度的浅克隆。
  • 自定义本地仓库目录

参数

必要参数

<Repository>        Specifies the path of target local repository or the URL
                    of target remote repository.

                    A typical URL mainly contains the following information:

                    * Transport protocal
                    * Remote server
                    * Path to the target remote repository

                    The syntaxes are shown below:

                    ssh://<User>@<Remote_Server>[:<Port>]/<Path_to_Target_Remote_Repository>
                    https://<User>:<HTTP_Password>@<Remote_Server>/gerrit/p/<Path_to_Target_Remote_Repository>

                    **Note:** For more information about the "<HTTP_Password>",
                    refer to Section 1 in `Cloning Tizen Source`_.

可选参数

-h, --help        Shows the help message and exit.
--upstream-branch <Upstream_Branch>
                  Specifies the upstream branch of the target package when
                  its upstream does not match the default settings, including
                  the following:

                  * upstream
                  * master
                  * pristine-tar

                  When cloning with this parameter, the upstream branches
                  cloned to local disk change to the following:

                  * <Upstream_Branch>
                  * master
                  * pristine-tar

--packaging-branch <Working_Branch>
                  Specifies the working branch that will be checked out.

--all             Tracks all remote branches.

--depth <Depth>   Creates a shallow clone with a history truncated to the
                  specified number of revisions.

<Directory>       Specifies the destination directory into which GBS clones
                  the repository.

示例

  • 克隆一个Tizen包

    $ gbs clone tizen:toolchains/zlib.git
    info: cloning tizen:toolchains/zlib.git
    .......
    info: finished
    $ cd zlib/
    $ git branch
    * master
    
  • 克隆一个Tizen包,以及跟踪所有的远程分支

    $ gbs clone --all tizen:toolchains/zlib.git
    info: cloning tizen:toolchains/zlib.git
    .......
    Branch 1.0_post set up to track remote branch 1.0_post from origin.
    Branch 2.0alpha set up to track remote branch 2.0alpha from origin.
    info: finished
    $ cd zlib/
    $ git branch
    1.0_post
    2.0alpha
    * master
    
  • 通过HTTPS 协议克隆Tizen包

    $ gbs clone https://<User>:nownjzm9ICUJ@review.tizen.org/gerrit/p/adaptation/systemd-bootmode