有時為了複現問題,我們需要對前幾天代碼倉庫中的代碼打包
將當天打包用的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.