This document is based on the code of android-4.1.1_r6 (Jelly Bean).
First, download the source code tree using repo
tool:
# mkdir android-4.1.1_r6.1
# cd android-4.1.1_r6.1
# repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r6.1
# repo sync
Then, modify .repo/manifest.xml
if you want to include your own git based projects (or other android related projects that are not included in the source code):
<project path="kernel/goldfish" name="kernel/goldfish" revision="android-goldfish-2.6.29" />
After that, do a sync again for the newly added project:
# repo sync kernel/goldfish
Finally, branch a topic for the projects you want to modify:
# repo start mybranch kernel/goldfish
# repo start mybranch libcore
...
# repo branch
* mybranch | in: build/goldfish, libcore