Thursday, December 3, 2009

How to revert (reverse merge) last svn commit from command line (cmd)

Working example on svn 1.6.x (this script reverts and commit latest revision automatically. It is necessary to be in root project directory):
svn up
svn merge -c -`svn info 2>/dev/null | head -n9 | tail -n1 | awk '{ print $4 }'` `svn info 2>/dev/null | head -n2 | tail -n1 | awk '{ print $2 }'`
svn ci -m "reverted invalid commit"

SVN syntax for doing reverse merge:
svn merge -c -{revision you want to revert} {project svn path}

No comments:

Post a Comment