Single File Checkout Using TortoiseSVN

Single File Checkout using TortoiseSVN is now (VERY) easy!

As I am not a subversion historian I cannot comment properly on the past difficulties of checking out a single file although I have struggled with it myself. I am not even sure at which release this problem became moot although the description below is using Subversion 1.6.13 and TortoiseSVN 1.6.11 on a Windows XP system. I am posting this because the explanations I was able to find on the web made this seem more complicated than it is (at least to me). It takes just two quick steps.

I presume the reader has a general understanding of Subversion (or SVN), TortioseSVN, and knows what a Repository is. Also "directory" = "folder" (for windows folks).

In the past one had only the option to checkout an entire directory including all its subdirectories and files. If you were interested in only a single file within a directory hierarchy it was a messy business to maintain revision control of it without checking out every file in the directory in which it resided.

Now however you can check out a single file in two steps.

STEP 1: Simply check out a parent directory from anywhere in the repository hierarchy above the file of interest by selecting "Only this item" in the Checkout Depth drop down list. This will create an empty directory representing that position in the hierarchy. The default name of the local checked out directory will be the same as its name in the repository but you may change that during the checkout if you wish.

STEP 2: Right click WITHIN the local checked out directory (or stand on its icon) and launch the Repo Browser from the TortoiseSVN submenu. Navigate to the file you want and right click. You will see an additional menu item "Update item to revision". Select this and that single file will be checked out into the directory just created!

You must launch the repo browser from the context of the local checked out directory; either within it or by standing on its icon. If you launch the repo browser from other contexts the option to "Update item to revision" will not appear on the context menu.

If the file, as it is in the repository, is several subdirectories below that which was checked out then these subdirectories will be automatically created (checked out) and your file will be at the end of the path they create. But ONLY the directories are created; no other files are checked out.

So if you want just the lone file in a directory then in the first step check out only the subdirectory which contains the file of interest. It is still true that you cannot have a subversion controlled file which does not have even a single checked out directory for context (the .svn or _svn (hidden) files used to maintain context need to go somewhere afterall) but I doubt that is an issue for very many.

Also note that you can add any number of individual checked out files in the same manner as long as they are below the highest level checked out directory in the hierarchy. This is useful if you have just two or three files you wish to check out in a large file structure.