Local branches pulling from one place and pushing to two different remotes and in different branches(names)

108 Views Asked by At

Lets say I have 2 unrelated projects (Talking about git), but due to my inconsistency I switch between them frequently. Both have a 'master' and a 'trunk' branch (and are both located at different hosting sites (github and gitorious) is it possible to created a 3-rd repository containing only the content of the trunk branches of those two under a different branch names? e.g.:... I though visualizing it would be more descriptive so:Image

In the end my question is what commands should I enter to be able to push from all the projects and the changes to be applied automatically (--mirror I'm guessing but after 1 day of reading left and right that's as far as I got)

Thanks in advance.

1

There are 1 best solutions below

5
On BEST ANSWER

Yes. Use git remote add to add each of your two repositories to a git archive (an empty one is probably sanest) and give them different names ("github" and "gitorious" seem sane). The after fetching each one, you will see their branches as "/remotes/{github,gitorious}/trunk" (or master, etc..) and can operate on them using git as you like -- e.g. cherry pick commits between branches, merge branches, get a log of differences, find the merge-base, etc...