repo 切换分支一种简单的方法

在Android开发中有时候要切换Android 版本,当前版本是

android-8.1.0_r2

如果我想切换到Android 9.0 的版本

android-cts-9.0_r2

可以进入到Android 根目录下

.repo/manifests/.git

vim  config
[core]
    repositoryformatversion = 0
    filemode = true
[remote "origin"]
    #urlhttps://aosp.tuna.tsinghua.edu.cn/platform/manifest
    url = https://android.googlesource.com/platform/manifest
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "default"]
    remote = origin
    merge = refs/heads/android-8.1.0_r2

把其中的 merge = refs/heads/android-8.1.0_r2 替换为
merge = refs/heads/android-cts-9.0_r2
然后进入Android根目录,删除当前所有代码
最后执行 repo sync
执行完毕之后,当前代码就是Android 9.0

你可能感兴趣的:(repo 切换分支一种简单的方法)