Sitemap

Checkout only one file from SVN

1 min readMar 24, 2017

--

If you try to checkout only one file from SVN:

➜ svn co svn://someurl/somedirectory/somefile.ext

it will give you an error:

➜ svn: E200007: URL ‘svn co svn://someurl/somedirectory/somefile.ext’ refers to a file, not a directory

This is a shame because what if I want to edit only one file inside of a repository which sizes billion gigabytes.

Get Umut Sirin’s stories in your inbox

Join Medium for free to get updates from this writer.

Thanks to this StackOverflow question, I learned how to checkout only one file or checking out single files whenever I want to.

➜ svn co svn://someurl/somedirectory <target> —depth empty

This code above will create a directory to the target with the name of somedirectory and will initialize .svn folder inside of it. But, there won’t be another gigabytes of files or folders. It will be empty. Now the tricky part:

➜ cd somedirectory 
➜ svn up somefile.ext

That command above will download the only file you wanted.

Originally published at usirin.tumblr.com.

--

--