Say you have a scenario with a central master git repository, which developers and CI-engines clone from. I.e. very close to a traditional non-distributed version control system setup, with a central hub and a lot of nodes. This could be a cloud service like Github (Gitlab/Savannah/Azure etc), or a Synology with git server or another in-house setup.
Now say that server was stolen or struck by lightning or any other thing that would result that the central repository was gone along with all its centralized backups. All you have left is the various clones, and by good fortune one of these was fully updated, so you create a blank git repository replacement server to be used as the future central repository and go to work on the clone.
The fully updated clone knows of all the "remotes/origin" branches with "git branch -a", but does only have a single local branch. (This is what worries me – losing branch information).
What would the steps be for reestablishing a new central git repository behaving in any way like the old one, branches and all?
Just create an empty repository and, from the fully updated clone, do:
Obviously, if the new origin is at the same url as the original one, you must be careful to not fetch from origin.