Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add/remove folders without downloading from the repository in Subversion?

I have a huge repository where I want to add/remove a folder. I haven't checked out anything yet. There is any way to do it fast?

like image 557
Jader Dias Avatar asked Jul 20 '09 18:07

Jader Dias


People also ask

How do I add a folder to SVN repository?

One way is to browse the repository to the place where you want to insert your new directory and right-click and select "Create Folder". Then right click the folder and check it out to the location where you want it. Then copy the directory of files you want to put into SVN into the folder created by the checkout.

How remove SVN added files?

$ svn delete -m "Deleting file 'yourfile'" \ file:///var/svn/repos/test/yourfile Committed revision 15. Use the --keep-local option to override the default svn delete behavior of also removing the target file that was scheduled for versioned deletion.

How do I delete a directory in SVN?

To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…

How do I move files in SVN without losing history?

If you right-drag the folder and use "SVN move versioned item(s) here", then you keep the history. Even the history of the files within the folder.


3 Answers

If you have the svn command line client then check out the commands svn mkdir and svn delete.

Full documentation is available by typing

svn help mkdir

and

svn help delete

like image 60
Noel Walters Avatar answered Sep 22 '22 03:09

Noel Walters


svn delete can operate either on a working copy or on a URL. When you specify a URL, the operation causes an instant commit - so be careful.

If you want to delete multiple, disjoint directories in a single commit, you can use the --depth argument to svn checkout to make a shallow (and therefore fast) checkout, on which you can operate locally and then commit.

Of course, this answer assumes that you only want to delete the file from the HEAD of the URL in question - if you want to completely erase a file/folder from the repository, you have more work to do.

(edit to add information about adding follows)

To add directories, you have to have a working copy. But it doesn't have to be a complete working copy: you can use --depth, as mentioned above, to only check out the directory to which you want to add your new directory, then svn add the new directory, then commit.

If the directory you're adding exists elsewhere in the repository, you could copy it with history using svn copy from one URL to another.

like image 29
Dan Davies Brackett Avatar answered Sep 18 '22 03:09

Dan Davies Brackett


If you're using Tortoise SVN, on Windows, this is easy. You can just do "View Repository" and add the folder on the server, all through the GUI.

like image 20
Reed Copsey Avatar answered Sep 20 '22 03:09

Reed Copsey