Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial Lost Work

Tags:

mercurial

I committed some changes (call it revision B). Then I did hg up A back to an earlier version to fix some bug. Forgetting I had done this update, I realized that I had committed my last changes to the wrong branch. So I hg rollback to get rid of that commit (B). It did that part well, but now I am sitting at revision A with the old code, my last commit gone, and hg st says everything is up to date at A.

I guess I lost everything that went into commit B? Is there any way to get it back?

Edit: I did not push this anywhere, it all happened locally

like image 378
Davis Dimitriov Avatar asked Oct 11 '22 04:10

Davis Dimitriov


1 Answers

Your changes are lost - rollback completely eliminates the commit (ref)(other ref). It's preferable to dorevert when attempting to access previous changesets, since that doesn't delete any subsquent changesets - it simply changes the current state of your files to look like they did at the changeset you're reverting to. So if you commit revision B and then revert to revision A, your files will look like they did at revision A, but any changes you make will be put into your next revision C, and revision B will remain in your repo.

like image 152
JustOnePixel Avatar answered Jan 01 '23 09:01

JustOnePixel