-1

Suppose I have a git repository set up on a central server and cloned it to multiple machines. Suppose also that I have made modifications to the repo on some of the machines and pushed and pulled from a subset of those machines.

Question:
If the central repository is deleted, is there an easy way to reconstruct the repository using only the (potentially inconsistent) cloned repositories on each of the machines?

1
  • Hmm... Downvote without explanation...
    – nehcsivart
    Apr 28, 2016 at 7:07

1 Answer 1

1

Assuming all clones are more-or-less trusted; on each clone, do:

git push --verbose origin "refs/remotes/origin/*:refs/heads/*"
git push --verbose origin "refs/tags/*:refs/tags/*"

This will push the results of the last fetch, resulting in mostly identical branches.

Afterwards manually go through each clone's local master and other branches, and push whatever's missing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .