Bagikan melalui


How to: Move, Rename, and Delete Version-Controlled Files and Folders

Files and folders under version control can be easily moved, renamed, and deleted from Source Control Explorer. For more information, see Using Source Control Explorer. Files and folder items can also be renamed and deleted from the command line. In order to simultaneously remove or delete multiple version-controlled files, you must use the command line. In the Source Control Explorer, you can only move, delete or remove one file or folder at a time. For more information, see Rename Command (Team Foundation Version Control) and Delete Command (Team Foundation Version Control).

Note

Tf.exe move is an alias for Tf.exe Rename.

The following procedures demonstrate moving, renaming, and deleting file and folder items under version control from Source Control Explorer.

Required Permissions

To perform these procedures, you must have the Check out permission set to Allow. For more information, see Team Foundation Server Permissions.

To move version controlled folders and files

  1. On the View menu, click Other Windows, and then select Source Control Explorer.

  2. Make sure that Workspace drop-down list at the top of the Source Control Explorer has the workspace selected where the item that you want to move is mapped.

  3. In the right pane of Source Control Explorer, locate the project in the workspace from which you want to move a folder or file.

  4. In the right pane of Source Control Explorer, right-click the specific folder or file that you want to move, and click Move.

  5. In the Move dialog box, either manually type the destination for the item in the To textbox, or Browse to use the Browse for Folder dialog box, and then click OK.

To Rename version controlled folders and files

  1. On the View menu, click Other Windows, and then Source Control Explorer.

  2. Make sure that Workspace drop-down list at the top of the Source Control Explorer has the workspace selected where the item that you want to move is mapped.

  3. In the right pane of Source Control Explorer, locate the project in the workspace from which you want to move a folder or file.

  4. In the right pane of Source Control Explorer, right-click the specific folder or file you want to move and click Rename.

  5. Type the desired name for the file or folder.

    You can rename an item that has a pending add but has not been checked in. However, you cannot rename an item that has been branched but not yet checked in or a conflict occurs. For more information, see Resolving Folder Differences and File Conflicts (Team Foundation Version Control). When you rename a file that has pending changes, the edits are preserved. If you rename a file for which a pending rename has been recorded, the initial rename change is replaced by the second rename change.

    Note

    Version control items can also be renamed from the command line. For more information, see Rename Command (Team Foundation Version Control).

To delete version controlled folders and files

  1. On the View menu, click Other Windows and then Source Control Explorer.

  2. Make sure that Workspace drop-down list at the top of the Source Control Explorer has the workspace selected where the item that you want to move is mapped.

  3. In the right pane of Source Control Explorer, locate the project in the workspace from which you want to move a folder or file.

  4. In the right pane of Source Control Explorer, right-click the specific folder or file that you want to move and click Delete.

    Note

    You cannot delete an item for which another pending change exists. For example, a checked out file cannot be deleted.

    An icon that indicates the item is deleted will appear to the left and the status delete will appear under the Pending Change column. The item is deleted the next time that a check-in is performed. For more information, see Pending Checkins Window.

    Note

    Version control items can also be deleted from the command line. For more information, see Delete Command (Team Foundation Version Control).

See Also

Concepts

Using Source Control Explorer

Reference

Rename Command (Team Foundation Version Control)

Delete Command (Team Foundation Version Control)

Undelete Command

Other Resources

Working with Version Control Files and Folders