Mecurial repository files lost - How do I recreate and push to the original cloned repo?

StackOverflow https://stackoverflow.com/questions/10840083

  •  12-06-2021
  •  | 
  •  

Domanda

I just lost my .hg* files for my repository after a migration and I have made a bunch of unpushed changes to some code.

I need to Init a new repository and then push my changes to an existing remote repository. Do I just need to init a new repo and then specify the remote repo in the hgrc and push? Thanks!

È stato utile?

Soluzione

If you remember the changeset you had in your original repo as its working parent (let's call it A), then you can do this:

$ hg clone http://server/upstream newrepo
$ cd newrepo
$ hg up A

Then copy the working copy of the original repo to the new repo (with an additional precaution of deleting all files from the new repo if you renamed / deleted anything in the old repo). Afterwards, commit and push from the new repo:

$ hg commit
$ hg push

If the upstream repo has anything on top of A, rebase or merge before pushing.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top