Do you have a branch checked out in your SVN and want to make an archive of only the source files and not the .svn directories ? Here is the trick.
To tar your SVN directory my_branch, go one level above and use one of the following commands based on your desired compression gzip or bzip2:
tar czvf my_backup.tgz my_branch --exclude='.svn*'
tar cjvf my_backup.tar.bz2 my_branch --exclude='.svn*'
This trick is helpful to exclude your desired patterns.
A more easier way is :
tar czvf my_backup.tgz my_branch --exclude-vcs
which would exclude all files related to the version control system, the supported ones afaik being CVS, SVN, RCS, SCCS, Mercurial and few others.
If your local copy builds few binaries like .o, .a, .so, etc. and you need to exclude them as well, you can combine --exclude-vcs with --exclude :
tar czvf my_backup.tgz my_branch --exclude-vcs --exclude='.so' --exclude='.o' --exclude='.a'
Or you can make the tar program read the exclude list from a file, adding one exclude pattern per line:
tar czvf my_backup.tgz my_branch --exclude-vcs --exclude-from=my_exclude_list
Contents of my_exclude_list:
*.so
*.o
*.a
Note: --exclude, --exclude-vcs, --exclude-from are all independent of each other and can be combined to get different results.
0 Responses to Archive your Version Control code-base easily
Something to say?