54

I'm using TortoiseSVN and I want to do a Checkout of an existing repository into a local directory. However, I only want to pull down certain portions of the file tree. Is there a way I can do that?

For instance:

/trunk
    /project-A
    /project-B
    /project-C

Let's say I just want to pull down trunk, project-A and project-B. How do I do that?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114

5 Answers5

79

It looks like you were successful but I wanted to include a step-by-step guide in the hopes that it is helpful to others.

  1. Checkout trunk into a working copy with depth = "Only this item"
  2. Open working copy
  3. Go to repo browser from the working copy
  4. Select your desired project subfolder(s), right-click and select "Update item to revision"

This will pull only the subfolder(s) you've selected into your working copy.

Michael Hackner
  • 8,605
  • 2
  • 27
  • 29
  • Hello. How can I stop "tracing" one of folders? I checkout whole trunk (many projects) and selected only few. But I don't need copy of one of those projects locally. How to "remove" it? – Hooch Nov 21 '14 at 13:05
  • 4
    Command line users can use these commands: `svn co --depth empty` `svn up /project-A` `svn up /project-B` `svn up /project-C` – doublehelix Jul 26 '17 at 09:40
50

This may be coming late, but for anyone finding this question and wondering if you could exclude existing directories: there appears to be a way to do so.

  1. Right click on the directory you want to exclude
  2. TortoiseSVN -> Update To Revision...
  3. From the Update Depth drop-down box select Exclude and press OK

That should delete the directory if it doesn't have any local mods and exclude it from further updates. If you ever need the directory back, use Michael Hackner's method above.

autonomy
  • 1,165
  • 1
  • 12
  • 18
11

Expanding on autonomy's answer from above ...

If you have checked out a whole project and later want to exclude certain folders or files from it....

  1. Right click on the parent directory that contains the dir/file you want to exclude
  2. TortoiseSVN -> Update To Revision...
  3. From the Update Depth drop-down box select Exclude and the click on "Choose items..." and
    • select the items you want to keep
    • and deselect the items you want to exclude
    • then press OK & OK again

That should delete the directories/files you have deselected and exclude them from further updates. If you ever need the directory back, repeat the process and change your selection.

Martin
  • 161
  • 1
  • 6
  • When you come back from selecting folders to keep/not keep, the Update Depth drop.-down has changed to Custom Depth. Do NOT change to Exclude again, just press OK. If you change it to Exclude, TortoiseSVN thinks that you want to exclude the parent folder which will fail. – Andreas Paulsson Oct 10 '17 at 09:49
  • What if I want to check out one previously excluded item and keep (but not update) all the others? – O. R. Mapper Feb 08 '18 at 10:05
4

If you go into the project-A folder and right-click==>SVN Update, it will only update the project-A folder and it's subfolders. Then you can do the same for project-B

Adam Albrecht
  • 6,680
  • 4
  • 31
  • 35
  • 1
    This is before I've even pulled it down once. Do I just create the trunk directory locally, then go in there, create the project-A folder, and then do a checkout of that project into that folder? – Scott Whitlock Nov 03 '09 at 15:26
  • Answering myself: yes, I had to create the trunk folder, do a checkout of trunk to this folder ("only this item"), then go into that folder, go to the Repo Browser and pull down the projects and files I wanted. – Scott Whitlock Nov 03 '09 at 15:32
  • Yeah you never have to pull down an entire project. From the Repo Browser, you can pull down whatever folders you want. – Adam Albrecht Nov 03 '09 at 15:57
3

This works as well:

  1. Right click > Select SVN Checkout
  2. Select "Choose items..."
  3. Select the subfolders/items you want [1]

[1] - Do note that if you checkout subfolders partially (without all the items inside that subfolder), and files are subsequently added to that subfolder and committed, you will not get them when you perform a regular checkout.

This question is related to Can you do a partial checkout with Subversion? but with a particular context of using TortoiseSVN.

Community
  • 1
  • 1
blizpasta
  • 2,624
  • 3
  • 25
  • 31
  • That first option doesn't exist when you've already checked-out anything on that parent folder. That's precisely why the question was asked. – Luis Gouveia Nov 14 '19 at 08:52