Switching Git branches inside an Android Repo project -
i have question switching branches using repo. know can checkout branch this:
repo init ... -b foo repo sync
my understanding checkout foo branch of manifest repository, , check out git projects described in manifest.
i understand can switch branches this:
repo init ... -b bar repo sync -d
my question is, can switch branches without doing repo init & repo sync each time, , implications of doing so?
let me illustrate example:
repo init ... -b foo repo sync -d repo start foo-mytopic proj1 proj2 ... repo upload -t repo init ... -b bar repo sync -d repo start bar-topic proj1 proj3 repo upload -t cd proj1 git checkout foo-mytopic # allowed?
i've tried before, , seems work, it's bit strange because have checked out code in foo manifest, current manifest branch bar. implications of being on different branch described in manifest?
note: i've read this, , think question different. know how switch branches. i'm interested in implications of being on different branch 1 described in current manifest , how might affect workflow.
since no 1 else able answer this, did more research , experimentation. here have found:
tl;dr - commands weird things. careful when using repo sync
, repo start
. try stick plain git commands. repo upload
should work.
the repo documentation says repo sync equivalent to
git remote update git rebase origin/<branch>
where branch the checked-out branch in local project directory. however, based on own experience, repo mess upstream tracking information branch based on in current manifest.
to continue example above, git checkout foo-mytopic
is, in fact, allowed, , kind of behave appropriately. repo upload push changes branch foo-mytopic
tracking (foo
), repo sync change upstream tracking information. in situation, may better manually run git remote update
, git rebase origin/<branch>
.
the manifest (and branch) described repo init not come play again until repo sync
or repo start
run.
Comments
Post a Comment