Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push an existing branch into a new repo using git?

I'm currently working on a project where we have a UI branch and a Services branch (not my branching design). We now need to separate them into two distinct repos. I am trying to find the best way to do this while preserving the history and not having the new repo track back to the old one.

Thanks in advance.

like image 228
Ryan Avatar asked Aug 18 '17 20:08

Ryan


1 Answers

You first have to add the new remote repository:

git remote add newrepo https://github.com/name.git

Then you could push your branch (yournewbranch) to this repository:

git push newrepo yournewbranch:master

If the master branch already exists you might force the update or push to an other branch on the new repository

like image 77
Achim Knupfer Avatar answered Oct 15 '22 18:10

Achim Knupfer