有时为了复现问题,我们需要对前几天代码仓库中的代码打包
将当天打包用的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.