-1

Keeping the git history preserved, how do I move code from a particular branch of repoA to another repository repoB?

Paolo
  • 13,742
  • 6
  • 28
  • 51
Aditya
  • 541
  • 5
  • 26
  • 1
    Add a new remote and push there? – Paolo Mar 31 '20 at 12:18
  • Does this answer your question? [pull/push from multiple remote locations](https://stackoverflow.com/questions/849308/pull-push-from-multiple-remote-locations) – phd Mar 31 '20 at 13:24

1 Answers1

0
  1. On repoA checkout the branch you want to move to repoB
  2. Add repoB as a remote: git remote add repoB https://github.com/repo/repoB.git
  3. Push your current branch to the remote: git push repoB

Note that in step 2 the 'remote' repo can actually be local (i.e. on your local box), e.g. git remote add repoB /home/repos/repoB/.git

simon-pearson
  • 1,359
  • 5
  • 9