2

I have 3 gits wrapped by a manifest file (this manifest file is in a fourth git):

If i want to check out one of the gits, I just use "git clone". After "git clone", I get a remote tracking branch named "master" which is perfect.

However, if I want to sync all three of the gits together, I "repo init"/"repo sync" the manifest file. However, the remote tracking branch "master" is not created in any of the three gits I get. Hence, i manually have to "git checkout -b master" to be able to push back to origin.

It works, but it is annoying to make that extra "checkout" step if you know what I mean? Is this by design? Is there an easy way out which I don't know about?

ola1olsson
  • 253
  • 1
  • 2
  • 11

1 Answers1

1

Check if this is enough to checkout the right branch directly:

 repo init -u url_manifest -b master

If not, you still can use repo forall in order to apply any command to all projects:

 repo forall [PROJECT_LIST] -c "git checkout -b master"
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The "repo init" did not work but the "repo forall" is great. Thanks – ola1olsson Mar 26 '12 at 19:57
  • `repo init -b` select on which branch the manifest itself should be selected, not which branch the repositories shall be checked out. Your example does not work if the manifest selects (some) repositories on another branch than master. – Bjarke Freund-Hansen Oct 24 '12 at 09:27
  • @bjarkef but a simple repo sync could then download the right code, following the branch-manifest, though? As in http://stackoverflow.com/a/11529936/6309 – VonC Oct 24 '12 at 09:39