androidrepositoryandroid-source

Android repo command and switching branches


I feel I have a pretty good understanding of git, but when it comes to the repo command, I get lost. I've read about the repo command, but I'm still not sure how it ties everything together.

My biggest question is:

Can I change my current branches from gingerbread to ICS and possibly back?

I see the command:

repo init -u https://android.googlesource.com/platform/manifest

From my understanding, this will create a repo with the master branch. If I want to specify the branch, I can do:

repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

The download is about 8GB, I believe, so I don't want to have to blow my repo away if they share code. is there a way to switch branches in repo?


Solution

  • If you run repo init -b OTHER_BRANCH a second time with a different branch, you can simply repo sync and it will not download the entire source code again.

    See repo help init for more options