Share via


Rename or move files and folders in TFVC

TFS 2017 | TFS 2015 | TFS 2013

Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | Visual Studio 2013

Important

If you're not using TFVC for version control, use Solution Explorer to move and rename files in your current open Visual Studio solutions or projects.

Move an item in TFVC

You can use Source Control Explorer to move one file or folder at a time. You should not use Source Control Explorer to move folders or files that are referenced by a Visual Studio project or solution. Move these files with Solution Explorer instead and check in the move in a new changeset.

  1. In Source Control Explorer, select the item that you want to move, open its shortcut menu, and choose Move.

  2. In the Move dialog box, either manually type the destination for the item in the To box, or choose Browse to use the Browse for Folder dialog box.

  3. Choose OK.

Rename an item in TFVC

  1. In Source Control Explorer, select the file that you want to edit, open its shortcut menu, and choose Rename.

  2. Type the desired name for the item.

Fix the outcome after you rename an item in your operating system

You should avoid renaming items managed by TFVC using your operating system (for example, using Windows File Explorer, or the rename command in the Windows command prompt). When you have used your operating system to rename an item in a local workspace, Visual Studio detects the change as two changes: an add and a delete. You can join the two actions into a rename action.

Note

Git version control users can move and rename files from the command line or Windows Explorer without this concern. The changes will be reflected in Team Explorer.

  1. In Visual Studio, in Team Explorer, choose Home icon Home, and then choose Pending Changes.

  2. In the Excluded Changes section, choose the Detected: link.

  3. In the Promote Candidate Changes dialog box, select the delete and add actions, open their shortcut menu, and choose Promote as Rename.

  4. A single rename change now appears in the Included Changes section.

Work from the command prompt

Tips

You must be one of the Contributors for your project. To learn more, see Default TFVC permissions.