Share via


Move, Rename, and Delete Version-Controlled Files and Folders (Team Explorer Everywhere)

You can move, rename, and delete files and folders under version control by using the Team Foundation Server plug-in for Eclipse or the Cross-platform Command-Line Client for Team Foundation Server. For more information about how to rename, move, or delete version-controlled files by using the Cross-platform Command-Line Client for Team Foundation Server, see Rename Command (Team Foundation Version Control) and Delete Command (Team Foundation Version Control).

You can also use the Team Foundation Server plug-in for Eclipse to undelete a file that you deleted from version control. For more information, see Undeleting Version-Controlled Files and Folders later in this topic.

Important

In Eclipse, you should use Package Explorer or Project Explorer and other integrated Eclipse views as much as possible when you change Eclipse resources. If you change resources by using Source Control Explorer that are mapped into your Eclipse workspace, Eclipse might not recognize those changes until you manually refresh your views. You should use Source Control Explorer primarily to make changes to items that are not part of projects that are managed by Eclipse.

In this topic

Required Permissions

To perform these procedures, your Check out permission must be set to Allow. For more information, see Team Foundation Server Permissions on the Microsoft Web site.

Moving Version-Controlled Files and Folders

To move version-controlled files and folders from the Eclipse workbench

  1. In the Eclipse workbench, right-click the file or folder that you want to move, point to Refactor, and then click Move.

  2. In the Move Resources dialog box, click the destination into which you want to move the file or folder, and then click OK.

    The item is updated. A pending rename operation (moving a file or folder uses a rename operation) appears in the Pending Changes window. The item is moved in Team Foundation version control after you check in pending changes. For more information, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

To move version-controlled files and folders by using Source Control Explorer

  1. In Team Explorer, expand the team project in which you want to move files or folders, and then double-click the Source Control node.

    For information about how to open Team Explorer, see Open Team Explorer.

  2. In the left-hand pane of Source Control Explorer, click the team project or folder that contains the file or folder that you want to move.

    Note

    You cannot move a file or folder if you have not specified a working folder for the team project. To set a working folder, right-click the team project node, and then click Set Working Folder.

  3. In the details pane (the right-hand pane), right-click the file or folder that you want to move, and then click Move.

  4. In the Move dialog box, either type the destination for the item in the To text box or click Browse to use the Browse for Folder dialog box to specify a destination, and then click OK.

    Note

    You cannot move a branched object inside another branched object.

To move version-controlled files and folders at a command prompt

  • At a command prompt, type a command line such as the following:

    tf rename OldItem NewItem

    Replace Olditem with the current identifier of the file or folder that you want to move. Replace Newitem with the new identifier of the file or folder. For more information, see the following page on the Microsoft Web site: Rename Command (Team Foundation Version Control).

    In other workspaces, the rename operation appears as a pending change. However, the detailed results of this command do not appear in other workspaces until you check in the change. For more information, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

    Note

    tf move is an alias for tf rename.

Renaming Version-Controlled Files and Folders

To rename version-controlled files and folders by using Source Control Explorer

  1. In Team Explorer, expand the team project that contains the files or folders that you want to rename, and double-click the Source Control node.

    For information about how to open Team Explorer, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

  2. In the left-hand pane of Source Control Explorer, click the team project or folder that contains the file or folder that you want to rename.

  3. In the details pane (the right-hand pane), right-click the file or folder that you want to rename, and then click Rename.

    You can rename an item that has a pending add action but that has not been checked in. When you rename a file that has pending changes, those changes are preserved. If you rename a file for which a pending rename operation has been recorded, the initial rename change is replaced by the second rename change.

  4. In the Rename dialog box, type new name for the file or folder that you want to rename, and then click OK.

To rename version-controlled files and folders from the Eclipse workbench

  1. In the Eclipse workbench, right-click the file or folder that you want to rename, point to Refactor, and then click Rename.

  2. In the Rename Resource dialog box, type the name that you want to give the file or folder, and then click OK.

    The item is updated in Project Explorer. A pending rename operation appears in the Pending Changes window. The item is renamed in Team Foundation version control after you check in pending changes. For more information, see Submitting Changes.

To rename version-controlled files and folders at a command prompt

  • At a command prompt, type a command line such as the following:

    tf rename OldItem NewItem

    Replace OldItem with the current identifier of the file or folder that you want to rename. Replace NewItem with the new identifier of the file or folder. For more information, see Rename Command (Team Foundation Version Control) on the Microsoft Web site.

    In other workspaces, the rename operation appears as a pending change. However, the detailed results of this command do not appear in other workspaces until you check in the change. For more information, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

Deleting Version-Controlled Files and Folders

If you delete a file or folder and then check in the change, you can recover the file or folder by using the Undelete command at a command prompt. For more information, see the following topic on the Microsoft Web site: Undelete Command (Team Foundation Version Control).

To delete version-controlled files and folders by using Source Control Explorer

  1. In Team Explorer, expand the team project from which you want to delete a file or folder, and double-click the Source Control node.

    For information about how to open Team Explorer, see Open Team Explorer.

  2. In the left-hand pane of Source Control Explorer, click the team project or folder that contains the file or folder that you want to delete.

  3. In the details pane (the right-hand pane), right-click the file or folder that you want to delete, and then click Delete.

    Note

    You cannot delete an item for which another pending change exists. For example, you cannot delete a file that is checked out.

    The status delete appears in the Pending Change column. The item is deleted after you check in pending changes. For more information, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

To delete version-controlled files and folders in the Eclipse workbench

  1. In the Eclipse workbench, right-click the file or folder that you want to delete, and then click Delete.

  2. In the confirmation dialog box, click OK to confirm the delete operation.

    If a second confirmation dialog box appears, to confirm the deletion of a read-only element, click OK.

    The item is removed from the Eclipse workbench and the local file system. A pending delete operation appears in the Pending Changes window. The most recent version of the item is deleted from the server repository when you check in pending changes. For more information, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

To delete version-controlled files and folders from the command line

  • At a command prompt, type a command line such as the following:

    tf delete [-recursive] Itemspec

    Replace Itemspec with the name of the file or folder that you want to delete from Team Foundation version control. For more information, see Delete Command (Team Foundation Version Control) on the Microsoft Web site.

    In other workspaces, the rename operation appears as a pending change. However, the detailed results of this command do not appear in other workspaces until you check in the change. For more information, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

Undeleting Version-Controlled Files and Folders

If you delete a version-controlled file or folder and then need to recover that file, you can undelete the item. To undelete an item, you must enable the display of deleted items in Source Control Explorer.

To enable the display of deleted items in Source Control Explorer

  1. On the Window menu, click Preferences.

    If you use Mac OS, click Preferences on the Eclipse menu.

  2. In the list, expand the Team node, expand the Team Foundation Server node, and click Source Control.

    You can also type Source Control in the search box to find the node.

  3. In Source Control options, select the Show delete items in the Source Control Explorer check box and then click OK.

To undelete a deleted item from Source Control Explorer

  1. In Team Explorer, expand the team project in which you want to undelete a file or folder, and double-click the Source Control node.

    For information about how to open Team Explorer, see Open Team Explorer.

  2. In the left-hand pane of Source Control Explorer, click the team project or folder that contains the file or folder that you want to undelete.

    Note

    By default, deleted items do not appear in Source Control Explorer. You must enable the display of deleted items before they appear. Deleted items appear with a dimmed name and with a value of Deleted in the Latest column.

  3. In the details pane (the right-hand pane), right-click the file or folder that you want to undelete, and then click Undelete.

    The status undelete appears in the Pending Change column. The item is undeleted after you check in pending changes. For more information, see Submitting and Undoing Pending Changes (Team Explorer Everywhere).

See Also

Other Resources

Using Source Control Explorer (Team Explorer Everywhere)

Placing Files under Version Control (Team Explorer Everywhere)