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

前端 未结 4 2248
天涯浪人
天涯浪人 2021-02-19 19:16

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

相关标签:
4条回答
  • 2021-02-19 19:30

    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. -_^

    0 讨论(0)
  • 2021-02-19 19:30

    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

    0 讨论(0)
  • 2021-02-19 19:40

    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.

    0 讨论(0)
  • 2021-02-19 19:49

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

    0 讨论(0)
提交回复
热议问题