Reputation: 16940
I need to download src code of different android tags. Each time it takes half an hour and GIGS of space. Instead I'd prefer to switch to different tag. How can I do so?
cd android-4.0.4_r1.1
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.4_r1.1
repo sync
cd ../android-4.2.2_r1
repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1
repo sync
What's the proper way to switch/update from android-4.0.4_r1.1 to android-4.2.2_r1?
Upvotes: 6
Views: 7589
Reputation: 441
As mentioned in the comments of the accepted answer, you can change the default revision in manifest.xml. There's a snippet about it in repo help init
:
Switching Manifest Branches
To switch to another manifest branch,
repo init -b otherbranch
may be used in an existing client. However, as this only updates the manifest, a subsequentrepo sync
(orrepo sync -d
) is necessary to update the working directory files.
This won't download everything fresh, but will perform the necessary git operations to checkout the correct branch/tag across projects. Actually, if you run it with --trace
, you'll see it does a good bit more than just git checkout
.
NOTE: If you use this method you must make sure you supply the exact same parameters to repo init as you had for your previous invocation. Specifically, if you supplied -g
options, supply them again or repo sync
will remove directories now unnecessary in the new set of groups.
Upvotes: 11
Reputation: 8350
You can fetch tags with :
git fetch
git fetch --tags
And do checkout by :
git checkout tag_name
Also if it is taking more time to sync than usual run below command in that repo :
git gc
Upvotes: -1