I have a repo named github.com/someorganisation/somerepo
.
A long time ago I copied it to github.com/someorganisation/somerepo-copy
Given that there has been a long time since this operation took place, I now want to force-copy/overwrite the entire github.com/someorganisation/somerepo
to github.com/someorganisation/somerepo-copy
Do I have to empty github.com/someorganisation/somerepo-copy
first?
CodePudding user response:
Just delete somerepo-copy
at GitHub. — Note that there is very little point having two identical but separate repos at GitHub. If the idea is to track somerepo
in another repo, fork somerepo
. That way, the fork can easily stay in sync with somerepo
and won't go "stale" like this.
CodePudding user response:
There's no need to empty it. You can just follow these steps:
warning: we are about to overwrite anything that exists on somerepo
with the contents of somerepo-copy
, so make sure that's what you really want because there is no going back.
(on somerepo-copy):
git remote set-url origin [remote-url]
, replace[remote-url]
with the repository's remote url, without the brackets.git push -f
: assuming that both repos are almost commpletely different, we are using the flag-f
to replace anything that exists on the remote server with whatever exists on your machine. If the repos aren't that different you could try using a regulargit push
.
after those 2 steps the folder somerepo-copy
will be "linked" to the remote somerepo
.
source: https://linuxize.com/post/how-to-change-git-remote-url/