Allan Jardine
Allan Jardine

Reputation: 5473

Duplicate git repository

I have a git repository on Github that I want to effectively split into two separate repos, with the history intact for each. The first (and original) repo will be used for the build code, while the new one will be used for the source files before building (its Javascript).

Once I have two separate repos I'll start modifying each so they each have their individual components.

The problem I'm having is that I can't seem to find a way to basically duplicate my current repo with a new name. I've tried creating a new repo, and adding it as the remote, but it doesn't include branches etc and I can't see a way to do that.

Can anyone point me in the right direction?

Thanks!

Upvotes: 1

Views: 289

Answers (1)

Jan Jongboom
Jan Jongboom

Reputation: 27342

  • Create a new GH repo
  • Add it as a new remote (e.g. remote2) - git remote add remote2 <URL for Repository>
  • Do a git push remote2 master to 'copy' over the current history and code over
  • Discard the remote and clone the new repo, start working

Tah dah.

Upvotes: 2

Related Questions