ChatGPT解决这个技术问题 Extra ChatGPT

How do you move a file?

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.)


g
goric

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-dragging. 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.

(Note that the SVN items in the following image will only show up if the destination folder has already been added to the repository.)

https://i.stack.imgur.com/3YzW2.png

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


When I highlighted all my files, right-dragged, the regular windows explorer menu came up. It let me select "move" but it wasn't an SVN option so I'm not sure anything even happened. When I checked to see if there were modifications, it said 300 files were deleted and 300 were non-versioned. This doesn't seem like it worked correctly. I'm afraid to commit it without knowing if this is the way it's supposed to work or not
I just realized it probably didn't work because I hadn't added/committed the new directory yet
I know this is years later -- but Joe's comment is important. i struggled with this too - I overlooked that little note in the answer. The destination Folder must be under SVN control otherwise this won't work. Thankfully SVN allows adding empty folders. After placing the folder under SVN control the Right-mouse Drag will operate as described above. Otherwise the generic Windows "Copy here/move here/cancel" menu is presented (ie. SVN choices are missing).
This was perfect. I had some issues moving over 1,500 files in one go. Moving them one directory at a time seemed to get rid of this issue though.
C
Commodore Jaeger

Subversion has native support for moving files.

svn move SOURCE DESTINATION

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


Or another way to say it: svn move <current path/filename> <destination path/filename>
K
Keith

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:

https://i.stack.imgur.com/cGWVO.png

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


This is my preferred way to move the files now. One warning; only do < 20 files at a time between commits otherwise it can be very timeconsuming to find the files that relate to each other.
@DarrenMB is right: I'm about to migrate an Android Project from Eclipse to Android Studio. All files have to be moved. This approach is not the one i want to use here.
@Bondax yes, for migrations of entire projects you're better off doing the move from within SVN - that should be something you do very occasionally. I found this the better way for the majority of file moves done by most developers during a project.
I don't have Repair Move either, using tortoise SVN 1.9.4
@Mark Patterson: I see the option and I am also on 1.9.4 (TortoiseSVN 1.9.4, Build 27285, and Subversion 1.9.4, -release). I don't think your problem is version related... Here is the official documentation of this feature: tortoisesvn.net/repairmoves.html
R
RedWolves

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"


佚名

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.


b
bahrep

For TortoiseSVN client:

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

Now you are done.


B
BornToCode

Cut file via operating system context menu as you usually do, then instead of doing regular paste, right click to bring context menu, then choose TortoiseSVN -> Paste (make sure you commit from root to include both old and new files in the commit).


J
John Boker

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


R
Ryan Lanciaux

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


Since that link could break, you may want to copy the relevant info into your answer.
...And that link has broken. Point and case.
a
aku

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.


D
DevelopingChris

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


the simplest and the most accurate answer is that one! using TortoiseSVN moving files is done with right-click > rename. that's it.
A
Anzar Ansari

Transferring a file using TortoiseSVN:

Step:1 Please Select the files which you want to move, Right-click and drag the files to the folder which you to move them to, A window will popup after follow the below instruction

https://i.stack.imgur.com/tf2tB.png

Step 2: After you click the above the commit the file as below mention

https://i.stack.imgur.com/VIMUC.png


D
Danijel

If you are moving folders via Repository Browser, then there is no Move option on right-click; the only way is to drag and drop.