Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 959
Lawrence Johnston Avatar asked Mar 04 '09 18:03

Lawrence Johnston


People also ask

How do I revert a specific commit in svn?

Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.

What is svn revert option?

svn revert will revert not only the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have performed (e.g., files scheduled for addition or deletion can be “unscheduled”).

How do I Uncommit files in svn?

To undo a specific revision you can use the following command: $ svn merge -c -r3745 . In case you have other edited files in working directory, you can commit only the relevant files. Please note that undoing actually will mean you create a new revision with the negatives changes of last commit.


1 Answers

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

like image 117
eduncan911 Avatar answered Sep 22 '22 05:09

eduncan911