Sampath
Sampath

Reputation: 65870

Replace B Git repo Master with another A Git repo master

I have 2 GIT repositories. Let's say A and B. Now I need to replace B master with A's master completely. I have done the same operation when B was empty. But now I have code on it. So how can I do that now?

I did this when B was empty.

git remote set-url origin https://github.com/sam/B.git

git push -u origin master

Upvotes: 0

Views: 33

Answers (1)

Paolo
Paolo

Reputation: 26084

Assuming you have already configured your remote:

git remote set-url origin https://github.com/sam/B.git

The following command should work:

git push -f origin master:master

it overwrites the remote master branch (B) with the "current" master branch (A)

Upvotes: 1

Related Questions