views:

5691

answers:

10

I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file from one folder to another in order to maintain its revision history. Is this possible? If so, how do you do it?

(My current strategy has been to copy the file into the new folder and check it in and then delete the file from the current folder.)

+9  A: 

Subversion has native support for moving files.

svn move SOURCE DESTINATION

See the online help (svn help move) for more information.

Commodore Jaeger
A: 

i think in the svn browser in tortoisesvn you can just drag it from one place to another.

John Boker
A: 

If I'm not wrong starting from version 1.5 SVN can track moved files\folders. In TortoiseSVN use can move file via drag&drop.

aku
A: 

May also be called, "rename" by tortoise, but svn move, is the command in the barebones svn client.

DevelopingChris
+4  A: 

Using TortoiseSVN I just right-click and drag the folder from one location to another. When you release the right-click you'll have the option to "SVN Move Version File." However, I believe that SVN doesn't do anything "fancy" there, but simply deletes the file in the previous location and Adds it to the new location.

+1  A: 

Since you're using Tortoise you may want to check out this link on LosTechies. It should be almost exactly what you are looking for.

http://www.lostechies.com/blogs/joshua_lockwood/archive/2007/09/12/subversion-tip-of-the-day-moving-files.aspx

Ryan Lanciaux
+10  A: 

Check out section 5.14.2. Moving files and folders (or check out "move" in the Index of the help) of the TortoiseSVN help. You do a move via right-draging. It also mentions that you need to commit from the parent folder to make it "one" revision. This works for doing the change in a working copy.

You can also do the move via the Repo Browser (section 5.23. The Repository Browser of the help).

crashmstr
+7  A: 

In TortoiseSVN right click somewhere and go TortoiseSVN > Repo Browser open the repository.

All you then have to do is drag and drop the file from one folder to the where you want it. It'll ask you to add a commit message and it defaults it to "Moved file/folder remotely"

RedWolves
+6  A: 

With TortoiseSVN I just move the file on disk.

When I come to commit my changes I select the missing file and the new one and select "Repair move" from the right click menu.

This means I can let my IDE move round files and use it refactoring tools without losing history.

Keith
Awesome. I was about to post a question on how to retroactively move files in svn, but this is what I was looking for.
itsadok
A: 

For SVN Tortoise

  1. Select the files you wish to move.
  2. Right click and drag the files to the folder you wish to move them to.
  3. A window will popup after you release the drag and drop on a folder. Click "SVN Move versioned item(s) here"
  4. After you click the above the commit window message box will appear. Enter a message and submit. Now you are done.
Martin