Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top