SaphuA
SaphuA

Reputation: 3150

Is it safe to delete the original repository after splitting it?

When our sources were migrated from TFS to git all projects were placed in a single repository. Later we learned this was not the recommended way so we decided to migrate each project into its own repository.

Because we did not want to lose our history (again) we used the following strategy:

Now that this is (almost) done I am wondering if it is safe to delete the old 'origin' repository entirely?

Upvotes: 1

Views: 31

Answers (1)

kdopen
kdopen

Reputation: 8225

It's unfortunate that you are almost done. A generally better approach to splitting a repository is to

  • Clone the original, complete, repository
  • Replace the remote with the URL of the new (empty) repo
  • Push the entire (original) repo to the new one
  • Only then, prune the new repository so that it contains only the files you want in this portion.
  • Repeat the entire process for each new child.

With this approach, any one of the new 'child' repos can be used to recreate the original complete one. They also each have a complete copy of the original's history. More importantly, if you deleted one or two files too many, you can recover them from within the new repository.

Finally, each new repository has a very clear history of commits showing how it was derived from the original.

With this approach it is then absolutely fine to delete the original, as it can be recreated at will.

In your current position, it is hard to tell without some very clear details about how you achieved the two steps you mentioned.

I would be inclined to mark the original as 'read-only' if your git server supports that, and retain it for safety's sake.

Upvotes: 1

Related Questions