How to rollback to committed and pushed revision in mercurial?
I made a mistake and removed a file. I'd like to go back to my previous commit! I tried with revert and backout with had no luck...开发者_C百科
Any tip?
Edit: I did exactly this:
hg forget file hg commit -m "Blah" hg push
The revision number of this last push is 17.
Now file is not tracked anymore. I'd like to get it back to revision 15 (not the inmediate previous rev, but one extra step back) as i do not want to keep working on the file in rev 16.
Found a solution:
hg revert file -r15 //(reverts file to revision 15).
If you have committed then you could update to previous version. If the file is version controlled, it is not going to go away. Thats what version control are for.
hg update -r "what is previous rev"
If you have removed a file and had not committed, then simply do the update and it will restore the file.
hg update
[edit: based on edited question]
hg revert file -r 15
hg update file -r 15
Try pulling version 15 and hg pull -r
and then adding the file.
精彩评论