repo sync配合manifest下載舊版本代碼

來源:互聯網
上載者:User

有時為了複現問題,我們需要對前幾天代碼倉庫中的代碼打包


將當天打包用的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.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.