Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to update a single file in SVN

Tags:

svn

I want to check-out and check-in a single file. I tried the command below but it did not work:

svn checkout <url_of_big_dir> <target> --depth empty

When I tried below command it worked.

svn export <url_of_big_dir> <target>

But I read in some documents it is not proper to use Export when your requirement is to update a file.

How do I update a single file?

like image 534
viki Avatar asked Feb 29 '16 15:02

viki


People also ask

How do I edit a TortoiseSVN file?

Click on the new working copy and right click to select the repository browser (TortoiseSVN -> Repo-browser) Right click the file of choice in the repository browser and select "Update item to revision"

How do I get the new changes in svn?

Simply type svn update [name-of-directory] , or cd to that directory and type svn update there. Show activity on this post. It's called "svn.exe": svn up .


1 Answers

Check out the directory, and only the directory (via --depth=empty), that contains the file:

svn checkout <url_of_big_dir> <target> --depth=empty

Next, go into the checked out target and update just the file you want:

cd <target>
svn update <filename>

Here, <filename> is relative to <url_of_big_dir>. From here, you can modify and commit it as normal.

The export command creates an unversioned copy of the file, which means you can't commit it back to the repository. If you don't need to do this, then export is fine and you can do it in one command:

svn export <url_of_big_dir>/<filename>
like image 133
Patrick Quirk Avatar answered Sep 21 '22 16:09

Patrick Quirk