How do I roll back all or part of a commit to svn?

ぐ巨炮叔叔 提交于 2019-12-09 14:49:41

问题


How do I revert all or part of an SVN commit using TortoiseSVN?


回答1:


First, you need to identify rather you want to revert back "all changes" of a revision, or just a single file. TortoiseSVN has only the "1 or all" approach; meaning, you can revert back the entire check-in set, or single files: not partial checkins.

Entire Changeset

So, if reverting back a specific revision (and you want all files in that changeset to be changed), you will want to Right-Click -> TortoiseSVN -> Show log. Find the revision/changeset you want to rollback to, right-click on that revision "Revert to this Revision".

There's another option which might interest you, which is "Revert changes from this revision", which will do a Diff-merge between that revision and your current version, and merge just the differences. I find this more appealing at times; so, I can keep all changes inbetween the changesets.

Single file

The other option is to revert a single file back. You would again do Right-Click -> TortoiseSVN -> Show log; but this time, you can select a single file.

TortoiseSVN does not let you select multiple files in a changeset to revert back to. It's either all, or just 1.

Changeset checkins

For all others reading, make sure "checkins" only involve the files related to that change. This should be common practice these days; but, I still find developers "shotgunning" the checkins at the end of the day, bundling up all changes for the day into a single checkin.

I gleam at those devs with w squint. -_^




回答2:


If you want to revert previously made commit (revision):

With explorer:

  1. Right click on file/folder you want to revert,
  2. TortoiseSVN->show log,
  3. right click on unwanted revision,
  4. "revert changes from this revision",
  5. commit->OK.

If you want to undo locally made changes (uncommited)

With explorer: Right click on file(s), TortoiseSVN->Revert.




回答3:


alternatively to what Bartek said, you can checkout a particuler revision to a local working copy, and commit it back to the head.




回答4:


Note that you can only "revert" in the sense that you check in a new revision, which no longer contains the changes you wanted to revert. That is described in the other answers.

You can not actually undo a checkin (as in "it never happened"), the old state will still be in the repository's history.

Really undoing/removing stuff is a longstanding feature request:

http://subversion.tigris.org/issues/show_bug.cgi?id=516



来源:https://stackoverflow.com/questions/611879/how-do-i-roll-back-all-or-part-of-a-commit-to-svn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!