Android repo command and switching branches

woodsdog picture woodsdog · Feb 1, 2012 · Viewed 32.9k times · Source

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?

Answer

gparent picture gparent · Jul 17, 2012

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