repoコマンドでダウンロード済みのソースツリーのブランチを切り替える

repoコマンドを使っていながら今まで知らなかったのが間抜けと言えば間抜けなんだけど。

AOSP(Android Open Source Project)からソースコードをダウンロードするとき、repo initの-bでAOSPの初期ブランチを指定(例えばgingerbread)してソースをダウンロード。そしてその後何らかの理由でそれをmasterブランチなど他のブランチに切り替えたい場合は、同じく

[cc lang="bash"]repo init -b master[/cc](masterへの切り替え)

で良かったのね…。で、そのあとrepo sync。(-d 付きのほうが良い?)

gitなので、おそらくできるんだろうと思ってはいたけれどヘルプを読むのを怠けて、いちいち別ディレクトリを切ってダウンロードし直していた。回線細いのに。

ようやく今日、真面目に調べてみてやり方が判明したのでメモ。

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 subsequent `repo sync` (or `repo sync -d`) is necessary to update the
working directory files.

タイトルとURLをコピーしました