Oct 20, 2009

SVN file rollback

This is quite often operation, however, this is also a most asked question - "I just broke a build by my commit, how can I rollback my changes ?" The answer is simple, but you just need to use command line svn client instead of your favorite IDE-embedded one.  Let's say, you just comitted an updated version of Bullshit.java and it broke the build. How to rollback quickly ?

1. Navigate to bullshit.java package folder:

cd com/myapp/bullshit

2. Check current revision of broken file (let's assume, the current broken revision is 500):

svn info Bullshit.java

3. If required, ensure that previous revision is the correct working file:

svn diff -r 499:500 Bullshit.java

4. Get back the previous revision of the file:

svn merge -r 500:499 Bullshit.java

5. Commit file and fix the build:

svn ci -m "I fixed the build"

And in some cases, you'd want to rollback entire trunk or folder - in this case, it it easier to do the following actions:

1. Delete current folder or trunk:
svn delete svn://svn.host.net/some/project

2. Restore deleted folder by copying appropriate revision from history:

svn copy svn://svn.host.net/some/project@24 protocol://svnserver/some/


where 24 - is a proper revision number you want to make current.

2 comments:

  1. Your blogs and every other content are thus interesting and helpful it makes me return back again.mu online

    ReplyDelete
  2. The first thing I ever saw the casino in Las Vegas was my first
    Wynn 대전광역 출장마사지 Resorts 충청북도 출장안마 is in the 원주 출장샵 planning stages of expanding Wynn Resorts into Las Vegas, one of 목포 출장안마 its most 상주 출장샵 recent projects.

    ReplyDelete