The Art of Software

SVN Command to Backup Modified Files


We’d like to be able to backup all of the modified, added, and conflicted files in our working copy.

svn status | grep -v ^[?D] | sed -e 's/^........\(.*\)$/.\/\1/g' | sed -e 's/\\/\//g' | tar czvf backup-`date +%Y_%m_%d`.tgz --files-from -

The grep may have to be adjusted a bit depending upon the state of your sandbox.

The second sed is due to the use of a native Windows version of subversion in Cygwin.

This post about removing unversioned files may also help. It provides some rationale for the first sed command.