3

I have a situation where I completely re-wrote the code from scratch where we had current existing code on the remote repo.

I would like to push my local new repo master to that existing remote as a branch to merge it later upon review.

Remote git repo: A has branches a1, a2, a3

My local new repo: B

After my desired push to remote: A has branches a1, a2, a3, and ab

Is it even possible?

Thank you.

Ganbayar Gansukh
  • 567
  • 5
  • 21
  • Related question: https://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories – Maximillian Laumeister Aug 28 '15 at 18:30
  • 1
    I suspect you will have to 1) clone the original repo 2) make a new branch 3) delete all files and commit 4) add all new files and commit 5) push new branch to remote – Plato Aug 28 '15 at 18:38

1 Answers1

4

Sure. Just push it like this:

git push origin master:ab

This will push your local master branch to ab branch of the remote named origin.

larsks
  • 194,279
  • 34
  • 297
  • 301