Checkout single file (sparse checkout) in Subversion (SVN). Get single file or selected files

By neokrates, written on July 21, 2010

howto

  • Join date: 11-30-99
  • Posts: 224
View Counter:
  • 7,416 views
Rate it
Ad
Poll
  • Which frameworks do you use to test your web frontend?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
👉 Reason, why it is not possible, is trivial: .svn metadirectory works ONLY on directory level, not for single file. That will probably change with WC-NG which does not work on per directory level.

The checkout operation is not possible on the single file (but it will be in 1.7). Still, there are at least two simple ways to get single file with subversion.

Svn before 1.7 supports only svn export on the single file:

svn export https://your.svn.host/path/to/your/file/file.name

 

⚠ That is not a checkout, you just get one file. It will not be under version control.

Alternatively, you can do an empty checkout and then pick a single file you want:

svn checkout $url_of_big_dir $target_dir --depth empty
cd $target_dir
svn up $file_you_want

 
Source:
http://stackoverflow.com/questions/122107/checkout-one-file-from-subversion

Be Sociable, Share!
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: +20 (from 26 votes)
23 votes 'YES'  3 votes 'NO'


TAGS

SOCIAL
Be Sociable, Share!

INCOMING SEARCH TERMS


3 Responses to “Checkout single file (sparse checkout) in Subversion (SVN). Get single file or selected files”

  1. […] Wi?cej: Checkout single file (sparse checkout) in Subversion (SVN). Get … […]

  2. Karl Roberts says:

    for me this didn’t work. I’m on Cygwin (using a Windows version of svn).. I needed to do
    cd $target_dir
    svn checkout $url_of_big_dir . –depth empty
    svn up $file_you_want
    cd –

    • admin says:

      Hey Karl,

      what version of svn do you use and what exactly was failing?

      Actually,

      svn checkout $url_of_big_dir . –depth empty

      and

      svn checkout $url_of_big_dir $target_dir –depth empty

      are equal. You just change the sequence : go into dir, checkout. Not checkout, go into dir.

      Obviously, you plan will not work if you don’t make or have $target_dir first, in my case svn creates it for you.

       

Leave a Reply