1:不同的项目通过repo init 来创建和切换 ,参数就是新项目的 manifest
每个manifest 包括 新项目目录结构, 包含的仓库, 每个仓库的版本号。
repo init: 只是从manifest.git中加载新的manifest.
repo init -b: 是从当前的manifest.git 切到一个新的manifest branch上
repo sync: 会根据新的manifest,从server中下载git数据到./repo/projects, 并根据版本号信息,将code checkout 到本地工作目录。
(
One useful tip
If the git repositories have been already downloaded by repo, you can change the branch of all projects by the following commands in the local directory:
repo sync
repo init –b new_branch_name
repo forall -c 'git fetch --all'
repo forall –c ‘git reset --hard revision’ #the revision is the value of the Attribute ‘revision’ in the file .repo/manifest.xml
repo sync
So you don’t need to get another copy of all projects.
)
2:一个项目所有的 仓库的数据 都保存在 .repo/ 目录下, 具体在 .repo /projects/*.git .
其实你在工作目录下,例如kernel目录下的.git 目录,都是重定向到这个 .repo/project/下的,所以说只要这个目录不丢, 你的这个项目的所有数据就不丢。
3: 不同项目, 如果都有同一个目录, 比如:msm项目有 ./external, clovertrail 项目也有./external, 那么这2个项目是可以共享同一个server上的库的,
所以你在通过repo init 切换之后, 在sync之后,.external.git 包含了2个项目的数据,和各个项目的branch。包括之前msn在本地新建的branch。
???
是在repo init之后 ,还是之前,就具备了2个项目的的所有branch 信息?