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

By neokrates, written on July 21, 2010


  • Join date: 11-30-99
  • Posts: 224
View Counter:
Rate it
  • What build management tool does your project or firm use?

    View Results

    Loading ... Loading ...
  • 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


⚠ 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


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'


Be Sociable, Share!


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?


      svn checkout $url_of_big_dir . –depth empty


      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