harsh atal
harsh atal

Reputation: 409

How to Push branch of one repository to a new branch in another repository?

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?

Upvotes: 4

Views: 3163

Answers (1)

mszymborski
mszymborski

Reputation: 1654

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

Upvotes: 4

Related Questions