基于git的仓库管理工具repo的简单介绍

一、repo介绍

repo命令行工具,是一个python脚本,对git部分命令进行封装,简化了对多个git版本库的管理,通过配置manifests配置文件,可以将很多个git仓库有效的进行组织管理。最开始是用在Android源码的管理上,目前被广泛使用。

二、repo使用

初始化命令:
repo init -u [<OPTIONS>]

-u: 指定连接到的manifest仓库地址
-m: 选择仓库中某个manifest文件,如果没有设置,就使用default.xml
-b: 选择一个maniest仓库中的一个特殊的分支或修正版本

例如:

mkdir repo_test
cd repo_test
repo init -u http://github.com/repotest.git -b testrepo

其中repotest.git 仓库是一系列需要拉取的git仓库配置default.xml

<?xml version="1.0" encoding="UTF-8"?>  

<manifest>  
    <remote name="origin" fetch="http://github.xxx.com" />
    <default revision="master" remote="origin" />
    <project name="myproject/repotest"  revision="master" path="test" />
    <project name="myproject/repotest1"  revision="master" path="test1" />
    <project name="myproject/repotest2"  revision="master" path="test2" />
</manifest>

执行完这个命令后,会在当前文件夹创建一个 .repo 文件夹,然后才能执行一系列repo的命令。

下代码命令:
repo sync -c -j4

-j : 多任务,一般8核心可以开到16任务,过多会起反作用
-c: 只下载当前分支代码
-d: 让工程回退到manifest指定的版本
-f: 如果某个工程同步失败,继续同步

三、repo常用命令

在初始化的带.repo目录的文件夹下执行repo help,显示常用命令如下:

usage: repo COMMAND [ARGS]
The most commonly used repo commands are:
  abandon        Permanently abandon a development branch
  branch         View current topic branches
  branches       View current topic branches
  checkout       Checkout a branch for development
  cherry-pick    Cherry-pick a change.
  diff           Show changes between commit and working tree
  diffmanifests  Manifest diff utility
  download       Download and checkout a change
  gitc-delete    Delete a GITC Client.
  gitc-init      Initialize a GITC Client.
  grep           Print lines matching a pattern
  info           Get info on the manifest branch, current branch or unmerged branches
  init           Initialize repo in the current directory
  list           List projects and their associated directories
  overview       Display overview of unmerged project branches
  prune          Prune (delete) already merged topics
  rebase         Rebase local branches on upstream branch
  smartsync      Update working tree to the latest known good revision
  stage          Stage file(s) for commit
  start          Start a new branch for development
  status         Show the working tree status
  sync           Update working tree to the latest revision
  upload         Upload changes for code review
See 'repo help <command>' for more information on a specific command.
See 'repo help --all' for a complete list of recognized commands.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值