repo sync配合manifest下载旧版本代码

有时为了复现问题,我们需要对前几天代码仓库中的代码打包


将当天打包用的manifest文件放到任何一套代码下的.repo/manifests/里面,假设这个文件名为pre_version.xml
然后执行
repo init -m pre_version.xml
接下来我们用命令
ll .repo/manifest.xml
查看打包所用的manifset,可以看到它已经链接到了我们制定的pre_version.xml


最后同步代码时为了安全,可以在同步时覆盖掉已经存在的代码
repo sync -cdf --force-sync

其中cdf等选项的含义:

$ repo help sync

-c, --current-branch  fetch only current branch from server

-d, --detach          detach projects back to manifest revision

-f, --force-broken    continue sync even if a project fails to sync

--force-sync          overwrite an existing git directory if it needs to
                        point to a different object directory. WARNING: this
                        may cause loss of data


repo sync的-c参数只下载当前分支,可以加快代码下载速度,而且节省硬盘空间


ps: repo命令的帮助形式为 repo COMMAND [ARGS]

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

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值