开发者

How do I revert back to a previous SVN commit?

Suppose I'm at revision 50. But, I want to revert back to revision 45, and commit back as the stable version.

How do I do that, in the most simple way?

  1. What if I want to do that with one file?
  2. Wh开发者_Python百科at if I want to do that with the entire repository?


I'm not sure what you mean by "commit back as the stable version", but depending on what you're trying to accomplish I recommend:

svn update -r45
This will rebase your working copy at revision 45.

or:

svn merge -c -50,-49,-48,-47,-46
This will update (by reverse-merging) your working copy by removing all the changes between 45 and 50. Now if you make changes and commit, it will be like you have removed 46-50 from the repository and made the HEAD revision (51?) to be r45 + your change.


Reverse merge those revisions that you want to undo. This can be done on one or multiple files. By reverse merging, your working copy gets changed to the state without that revision, which you then can commit.


You can simply do an update to revision using

svn up -r 45

But this will not let you commit the changes as SVN needs you to update your working copy to HEAD before you can commit. What you can do instead is

svn merge -r HEAD:45 yourFile
svn ci yourFile -m "Reverting back to rev 45"


I think one simple way should be this:

  • checkout revision 45 to a temporary directory
  • copy one or alle files to your working directory
  • commit
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜