Wednesday, August 10, 2011

Removing files from working directory not under version control

   I've been using SVN since the beginning of summer and I'm liking it so far. However, I stumbled across a little problem this week.

    I use SVN to write a LaTeX document which spans multiple files. Being textual, the contents of the .tex files are diff-able and all the features of SVN can be used. However, when I compile the document to have a nice PDF file, a plethora of files are simultaneously created. I don't want to put these files under version control. I hear you say: "Well, do not add them to your repository, then!". Fair enough, here's the result of a svn st:
Cluttered up svn st. I hate cluttered 
I hate cluttered things! Now, the easy solution is to remove all files you do want to put under version control, marked by a '?'. You always the manual way, i.e. rm file1 file2 file3 ... fileX but that's cumbersome. Let's use some of our bash knowledge to solve this problem. 

WARNING. The following command will remove all files marked with a '?'. Be careful with it!

rm `svn st | grep ?`

Simple enough, huh? 

No comments:

Post a Comment

I'm very sorry to put you through the CAPTCHA. I tried to remove it, but the spam comments were unbelieveable. Here's a funny website to compensate: http://craptchas.com/