SVN - How to upload a single file?

How to upload a single file from my local computer to the SVN repository?

I can import a directory, but I cannot import a single file into an existing directory.

I am using SVN in linux (command line).

Any help would be appreciated.

Edit: I forgot to mention, I need to upload this file to a specific directory, which has nothing to do with the directory structure on my local computer (let's say I boot from the desktop).

So, I want to download the file from the desktop to https: //.../somefolder

+7
linux import svn upload
source share
4 answers

Well, the short answer is that it doesn’t work like that :) In SVN, you work with a verified version of your repository. To “upload a single file”, you must “add” the file using “svn add foo.txt” and then run “svn commit -m” The foo file “foo.txt” has been added. But you can only do this in an existing repository. Therefore, you must first check the version (rev trunk or specified branch) of the repository to add the file. So all steps would be something like

After that, you can delete your local copy again.

8-year edit: As mentioned, svn import can also be used to achieve this without a local copy under version control. Note that this happens so recursively and will add directories that are not in the repository. This may be desirable behavior or a source of potential errors depending on the situation.

+13
source share

This can be done as required by the OP.

svn import -m "Adding a new file" file_to_upload.ext http://example.org/path/to/repo/file_to_upload.ext 

This allows you to upload the file directly to the repository without checking the local working directory.

+20
source share
 svn add filename svn commit filename 
+1
source share
 svn add /path/to/your/file.txt svn ci /path/to/your/file.txt -m "This is where the message goes" 

Or, if you haven’t added anything else, just commit with

 svn ci -m "Your message" 
+1
source share

All Articles