Ivan
Ivan

Reputation:

How do I edit and commit a single file from a Subversion repository?

Using TortoiseSVN (a command line solution is OK too), without creating a folder on the repository side, what are the steps to checkout a single file, edit and check back in with comments?

Upvotes: 6

Views: 26795

Answers (6)

OzgurH
OzgurH

Reputation: 453

I'm guessing this particular feature was not available when this question was asked, but on my currently installed version (TortoiseSVN 1.14.7, Build 29687) I do see an Edit context menu in Repository Browser when I right-clicked on on XML file. When you save the file in the opened editor (Win11 Notepad in my case), and exit the program, a commit comment window popped up allowing me to check the file back in!...

Sorry for such a late resurrection but let me add this for the googlers coming here after 15+ years! :)

When I tried to use the feature for a PNG file (for which an "Edit" shell command was not defined on my computer), it showed me a file selector to pick a .exe. So I'm guessing Tortoise tries to find and trigger the Edit shell command for the file type, and if one is not available, it lets you pick up an editor application - haven't tested, and couldn't find relevant doc unfortunately)

(Feature was added probably(?) in version 1.5.0-alpha1 according to ChangeLog).

Upvotes: 0

Serve
Serve

Reputation: 99

You have a file single.txt you want to commit.

The right procedure is :

cd /path/destination_directory
svn up
svn commit single.txt -m "Insert here a commit message"

Hope this will help.

Upvotes: 1

SteveW
SteveW

Reputation: 121

This is possible with TortoiseSVN, but you must checkout the parent directory as well:

  1. Create a working copy of the directory with no contents (use checkout depth "Only this item")
  2. Click on the new working copy and right click to select the repository browser (TortoiseSVN -> Repo-browser)
  3. Right click the file of choice in the repository browser and select "Update item to revision"

Upvotes: 2

Nuno Furtado
Nuno Furtado

Reputation: 4568

AFAIK you cannot get a copy of a single file from SVN, a working copy is always a directory. So you will need to check out a whole folder in order to edit the file in question and then commit.

This was the case some time back (less than 3 months) and I doubt it has changed since then.

Upvotes: 5

Daniel A. White
Daniel A. White

Reputation: 191048

  1. Right click in Windows Explorer where you want a working copy.
  2. Choose Check Out. It might be in TortoiseSVN's menu.
  3. Enter the URL and accept to get a working copy.
  4. Make the change to the file.
  5. Right click in the working copy. Choose commit.

OR

Refer to Stack Overflow question Checkout one file from Subversion.

Upvotes: 3

ojrac
ojrac

Reputation: 13421

To check out a single file, you'll still need to check out its parent directory. From the command line, to check out https://svn.example.com/trunk/myfolder/index.html:

svn co https://svn.example.com/trunk/myfolder/ --depth empty
svn up myfolder/index.html

Now, you can edit and commit this file as usual, without checking out anything else.

TortoiseSVN also includes "checkout depth" in its svn checkout menu option; however, I don't know of a way to make Tortoise do svn up filename on a file that doesn't exist.

Upvotes: 3

Related Questions