Chovy’s Blog

Example of How to Ignore Files in Subversion

Wed, July 4, 2007 — Category: Development

Brief example of how to ignore files in subversion. Great for those pesky session, cached files, or logs that are constantly changing and are not necessary to “version”.

Have you ever had those pesky little files constantly telling you they’ve been modified? …you couldn’t care less about “commiting” them into the subversion repository every time, right? — log files, session data, temporary caches are all great examples of things that should probably be ignored and forgotten.

Ignoring locally modified files in subversion is quite easy, once you get the hang of it.

I struggled a bit with the example from the SVN book. Mainly because I was unsure where to actually set my property.

I’m writing an application with Smarty and PHP and have several temporary files created in my development environment and wanted to simply “ignore” them all so they do not keep showing up when I run an “svn status” command…


$ touch ./template_c/foo
$ svn st
?      template_c/foo

Everything under “template_c” should be ignored by subversion, I do not want to version temporary cache files of templates created with new requests.

Here’s the quick and easy way to get it done…


$ cd ~/trunk
$ svn propset svn:ignore '*' ./template_c/

First, I change directory into the trunk (or parent of the directory I want to ignore).

Then I simply set an svn property “svn:ignore”, which takes 2 property arguments: the pattern of the file to ignore, and the directory path to apply it to.

In other words, I am telling svn to set the property “svn:ignore” to ignore all files “*” under the sub-directory “./template_c”.

If I wanted to ignore only smarty template php files, I would’ve used something like:


$ svn propset svn:ignore '*.tpl.php' ./template_c/
#ignores files such as "foo.tpl.php"

However, I still have one last step, as shown by the following “status” command:


$ svn st
 M     .
 M     template_c

…commit the new property for the current directory (this property will apply to all svn users once committed).


$ svn ci -m 'ignore smarty template caches' .

If you want to only apply the change to your local repository, then look into the ‘-F’ option to “svn propset” to specify a local file with a list of file patterns to ignore. This way, developers can add/remove entries from their own local copy if they wish.

One last trick — if I really want to see what is in the ignored directory, I just run the command with the “–no-ignore” option:


$ svn st --no-ignore
I      template_c/foo
  • Post Example of How to Ignore Files in Subversion to del.icio.us
  • Post Example of How to Ignore Files in Subversion to digg
  • Post Example of How to Ignore Files in Subversion to Furl
  • Add Example of How to Ignore Files in Subversion to YahooMyWeb
  • Simpify!
  • Post Example of How to Ignore Files in Subversion to shadows
  • Post Example of How to Ignore Files in Subversion to Spurl
  • Post Example of How to Ignore Files in Subversion to BuddyMarks
  • Submit Example of How to Ignore Files in Subversion to Slashdot

4 Comments »

Comment by atribut957

October 28, 2007 @ 3:29 am

1000 форумов 2 доллара 5000 форумов 8 долларов 10000 форумов 13 долларов 50000 форумов 50 долларов
Бонус предложение для тех кто закажет 20000 форумов через неделю повторная отправка
Рефпредложение: человек который приведет мне клиента будет получать 10% от заказа клиенка!!!
Обращаться в асю 3пять3-8шесть7-0ноль1 мыло anhelluss(гав)yandex.ru

Trackback by buy online tablet vicodin

November 2, 2007 @ 1:37 pm

buy online tablet vicodin…

Pretty much nothing exciting going on these days. I haven’t been up to much , but pfft. I haven’t gotten anything done , but I guess it doesn’t bother me. Shrug. …

Comment by niagara

November 9, 2007 @ 1:09 pm

Hi! I need help!

Trackback by Online pharmacy with adderall.

March 22, 2008 @ 3:50 am

Adderall 25 mg online….

Adderall online order. Buying adderall online. Adderall online pharmacy. Adderall online support boar….

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

 
Keyword Advertisers:
SEO Directory SEO Links Free Link Directory Shopping Submission Directory Gardening Tips Political Forum Search Engine Optimization Search Engine Marketing Audio Video Directory SEO Forum Web Development Blog Organic SEO Wiki Web Development Consulting

Learn more about purchasing keyword text link ads on this site.