1

I'm working on git in order to organize a big project that should contain two different subproject independetly
each project contain 4 brachs that represent the different version of it
what I want to do is to create a git repo and 8 branchs(4+4) so that each branch will contains what the refereced branch should contains

however,the main problem is that I didn't find a way to clone a branch and push it into another git repo.

Tnx

2 Answers2

0

Isn't it just git fetch <remote_name> <branch_name>? Unless you really meant an independent clone per branch git clone --single-branch --branch <branch> <url>. The push would be git push <remote> <branch>

Allan Wind
  • 23,068
  • 5
  • 28
  • 38
  • but when i push it says that there is no changes to push – Nessrine Nour Elhouda Dec 29 '20 at 11:29
  • what I want to do is to extract a branch A from projectRepo B and clone it with it histrory into another git repo C – Nessrine Nour Elhouda Dec 29 '20 at 11:42
  • i tried to use your commande and i had this error the source reference specifier refs/heads/master does not correspond to any reference error: impossible to push references to – Nessrine Nour Elhouda Dec 29 '20 at 11:56
  • So you have two unrelated repos each with 4 branches and you want to merge into a new repo? https://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories might be your answer instead of what I suggested then. – Allan Wind Dec 29 '20 at 12:11
0

While I have illustrated how to push a branch from a repository to a separate empty repository in your next question, you could, once you have separated those sub-projects in their pwn repositories, consider submodules.

That would allow for your main project to reference those other repositories as submodules, allowing them to evolve on their own, while being re-grouped in the main repository.

I understand you had an issue with submodules and Eclipse, but as I described here, you can update those submodules if Eclipse did not fully initialized them.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250