4

I have a branch "tree" in my testing repository.

Now i want to move that branch to a new repository "react-tree-component" as the brand new master branch,

Testing > tree
MOVE TO
react-tree-component > master

Use Case : I have a testing repo in which I treat as rough work..but sometime the work turns out to be useful and can be a starting point of another project deserving its own repo....therefore need this

how can i do this?

harsh atal
  • 411
  • 6
  • 16
  • 1
    Try to add the new remote (`git remote add react-tree-component `) and push the branch (`git push -u react-tree-component tree:master`), assuming master does not exist there. – mszymborski Apr 08 '18 at 11:54
  • 1
    @mszymborski , thanks got it! – harsh atal Apr 08 '18 at 11:59
  • 1
    Possible duplicate of [pull/push from multiple remote locations](https://stackoverflow.com/questions/849308/pull-push-from-multiple-remote-locations) – phd Apr 08 '18 at 14:30

1 Answers1

4

You first need to add the new "target" remote:

git remote add react-tree-component <url>

And then push with rename:

git push -u react-tree-component tree:master

mszymborski
  • 1,615
  • 1
  • 20
  • 28