简体   繁体   中英

How to revert SVN commit in PhpStorm

I made a SVN commit with a wrong message and the SVN server obviously does not support comment editing. So I thought I could generate a "revert" commit and then re-commit with the appropriate message.

Since I don't have any command line SVN client (I use PhpStorm SVN plugin), I'm wondering if it's somehow possible to generate this revert commit in PhpStorm.

Another way to revert a commit that affects multiple files using the commit history:

  1. With one of the affected files open in the editor, show the file's commit history with VCS > Subversion > Show History (or any shortcut method)
  2. Right click the commit to be reverted and select Show All Affected Files
  3. Select all the files in the popup (there are no checkboxes but the files can still be selected)
  4. Click on the Revert Selected Changes icon on the topbar of the popup
  5. A dialog box will come up allowing you to put the changes into a new or existing change list, which you can then commit as usual

Use Subversion->Show History to get a list of all the commits of the file. Right-click on the 2nd-to-last commit and select "Get" to copy that version into the editor. Then Commit this to revert to that previous version.

Since my commit involves many files, I didn't use barmar's answer (which is perfectly acceptable for single-file commits), but I used patches instead:

  1. create a reverse patch AND a non-reverse patch for the wrong commit (right click > Create patch)
  2. apply the reverse patch
  3. commit with a message like "Reverse previous commit (wrong message - stupid me)"
  4. apply the non-reverse patch
  5. commit with the appropriate message

This is tested in WebStorm 10, but probably also works in PhpStorm:

  1. Open the Version Control tool window by pressing + 9 or Ctrl + 9 .
  2. In the tool window, select the Repository tab.
  3. In the list of commits, right click the commit(s) you want to revert and click Revert Changes .
  4. Commit with an appropriate message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM