sbi
sbi

Reputation: 224089

Transplanting local branches from one repo to another

There was a git repo R, which was split by cloning several other repos (let's call them R1, R2...RN, or RX for any of them) from it and deleting different stuff in those repos. For new projects, these new repos are about to replace R. Old projects will either ported to the clones or stick with R. If someone makes a late fix to R, they can push it to our central repo and it can from there be merged into the appropriate clone(s).

However, in the local clone of R on my disk, I have a couple of branches that contain private experiments which I do not want to lose, but which I do not want to push to central either.

Is there a way for me to merge these branches into the respective RX clone without having to push them to central first?

Assume I can rebase all those branches onto the latest master in R, and that the clones are up to date regarding their R's master.

Upvotes: 1

Views: 102

Answers (1)

sbi
sbi

Reputation: 224089

So I got this working by making my local clone of R a remote for my local clone of the RX repository I want to transplant a branch to. When in the targeted repository RX, in git bash on Windows, this does the trick:

git remote add local_R file:///c/path/to/R

Within RX, I can now fetch from local_R, check out R's branches, merge them into RX's branches, etc.

Upvotes: 1

Related Questions