Saturday, September 12, 2020

Revert SVN commit - Most sure way to get it done


Say you got some old repo on svn, you hate that it is on svn but not git. Yet you want to revert a commit/s cleanly like you would do it in git 😃 This is how  

  You will have to use both svn command line and TortiseSVN to make it simple and clear. 

1. First go inside the folder from command line and updae the code base to latest revison as following.  

>svn up -r HEAD # get latest revision


2. Then go to TortiseSVN "Show Log" and copy the revision ids(to notepad) that need to be removed from latest to oldest.

3. Say revison 120 and 118 need to be removed. First we should remove 120 and commit it, then proceed to 118. Why ? So each commit related issued fixed individually. Clean and ATOMIC.

4. Go to command line and revert 120 commit

>svn merge -c -120 . # undo revision 120



Then go to TortiseSVN select commit, check the diff and see it is as intended, add a commit message like "revert of commit 120" and commit.

5. Do the same for 118
>svn merge -c -118 .  # undo revision 118
Commit with TortiseSVN same as for commit 120. You don't have to use TortiseSVN for the commit. You can just use following command. 
> svn commit           # after solving problems (if any) 
But I personally like to cross check the change from another tool before releasing to production.
  

Share Article : Revert SVN commit - Most sure way to get it done
Share/Save/Bookmark

0 comments:

Post a Comment