I have a workspace that is lost forever. I have some files checked out from this workspace. I want to unlock them but I can't. I tried to do:
TF UNDO $/MyProject/MyFolder/MyFile.cs /WORKSPACE:LOST;user /s:http://mysite:8080
But I got this message:
The workspace LOST;user is not on this
computer. Run get (get all if edits
were undone) on the computer hosting
that workspace to update it with the
change s that have been made on the
server.
Does exist any way to undo a file (not every file) checked out by unavailable workspace?
If the workspace is lost, then I would just delete it. Deleting it undoes any changes that were made in it.
tf workspace /delete WorkspaceName;WorkspaceOwner
As long as you have the appropiate permissions I would think that the method from this answer by #BubbleSort should work: https://stackoverflow.com/a/17870318/1982894
He used TFS 2012, I have tested it in TFS 2010 and it works there too.
Answer copied for easy reference:
(Note: I have the TFS Power Tools installed so if you don't see the
described options you may need to install them.
http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f
)
If you are accessing the Source Control Explorer as a team project
administrator (or at least someone with the "Undo other users'
changes" access right) you can do the following in Visual Studio 2012
to clear a lock and checkout.
From the Source Control Explorer find the folder containing the locked file(s).
Right-click and select Find then Find by Status...
The "Find in Source Control" window appears
Click the Find button
A "Find in Source Control" tab should appear showing the file(s) that are checked out
Right click the file you want to unlock
Select Undo... from the context menu
A confirmation dialog appears. Click the Yes button.
The file should disappear from the "Find in Source Control" window.
The file is now unlocked.
Related
Using TFS everywhere. Editing files without "checkout for edit".
after it, unable to see edited files list in "TFVC pending changes" window.
Try to see if your project is Offline, that is the behavior when your project is not connected with the TFS.
1- Right-click on the solution name right at the top of the Solution Explorer and select the Go Online option
2- If that doens't help, please check your connections to the tfs through the Team Menu -> Manage Connections.
3- If still happens, try to restart the Visual Studio
You are using Team explorer everywhere. Try to check whether your project is offline:
Right click your project > Team > Return Online.
BTW, the project will be offline if you switch workspace to other that isn’t include that project.
Update:
Pending changes window > Click Actions > Detect Local Changes, then the modified file (tracked by source control) in current workspace will be included in Included Changes
I'm using Visual Studio 2015 and have deleted a branch from our TFS source control. Looking at other guides there's mention of being able to recover the branch by opening Source Control Explorer, right-click and select 'Undelete' or 'Rollback'. These options are not available
I have not got this branch mapped on any workspace. Clicking on 'Undo Pending Changes...' brings up a message saying there are no pending changes. How can I restore a branch on TFS? Is there a way I can enable Undelete or Rollback?
First, please make sure you or your teammates haven't destroyed this branch (After doing this, there is no way to recover it in TFS server).
If you delete this branch in Visual Studio,
To restore an item deleted from the server
From the menu bar choose Tools, Options.
On the Options dialog box, navigate to Source Control, Visual
Studio Team Foundation Server.
Select Show deleted items in the Source Control Explorer, and then
choose OK.
From the menu bar choose View, Other Windows, Source Control
Explorer.
In Source Control Explorer, navigate to the folder that contains the
item you want to restore.
Open the item’s context menu (select the item and right-click it) and
then choose Undelete.
If you delete this branch from your dev machine outside of Visual Studio,
Please check the solution from MSDN link Delete or restore files and folders
Morever, you can also try to use the undelete command restores items that were previously deleted. For Example:
tf undelete [/noget] [/lock:(none|checkin|checkout)]
[/recursive] itemspec[;deletionID] [/login:username,[password]]
Update:
Note: To be able to undelete a branch you must first map the parent folder/branch to your workspace. Now, the undelete option will be enable.
According to the screenshot, there is no workspace configured for it. Try configuring a work space for the project that include the deleted branch to see if the "Undelete" option will be activated.
In Visual Studio go to [Tools->Options] then Select [Source Control->visual Studio Team Founation Server] and check the [Show deleted items in the Source Control explorer].
After that, you can then right click a folder and say "Undelete"
I currently work with a Team Foundation Server and Visual Studio. Since two days, I keep getting error messages that I can't write to files (it seems not to matter which file I try to access). I am the only one in my team who has those problems.
So when I try to check-in, I get:
When I click on Overwrite, I can overwrite it. But when I try to check-in pending changes, I don't see any changes. If I modify a source file, I can compare it to the latest version and see that there are changes.
How can I fix this? I simply would like to work ...
Work-around: If I "Check Out for Edit..." the file (so I get the lock) I can edit it. But this doesn't work for the solution file, because somebody else checked it out.
Go to Solution Explorer
Right click on your solution
Click Go online
It seems that your solution is not connected to the Team Foundation Server.
I would recommened that you remove the mapping of your workspace, delete all local files of the workspace and then get a fresh version (Get latest version) from the Team Foundation Server.
To remove mapping you need to open the Source Control Explorer in Visual Studio. Navigate to the Branch you are working on and open the Context Menu (right click on branch). In the menu you select Advanced->Remove mappings....
In the dialog you can edit or remove the mapping of your workspace. (Note: When you select Remove mapping then will all files in the Local Folder be removed that are controlled by TFS)
What you also can do is to check the state of your workspace/solution if it is connected to TFS. To do that you need to open the solution in Visual Studio and then open File->SourceControl->Advanced->Change Source Control... in the File Menu of Visual Studio.
In the Dialog you will see if your Solution and projects are connected to TFS and the server they are connected to
You should have the correspondings local files like in the source control.
Go to the local file, right click on it and choose Properties,
in the opened dialog uncheck the read-only checkbox, click Yes to the question if you want to apply changes to all subfolders and files.
Hope this is helpful.
You will face the same problem when setting your Workspace location to server (which in my case happened somehow magically).
To change the location to local again open the source control explorer and in the upper part you find a drop down labeled "Workspace". From this drop down choose "Workspaces...". This opens the "Manage Workspaces" dialog where you can select your workspace and click the "Edit" button. In the Edit dialog click the "Advanced" button and you'll see a drop down for Location where you can change it to Local again.
MSDN provides detailed information on the pros and cons of local and server workspaces.
Somehow TFS Power Tools thinks my file is checked out, it won't let me check-out because that option is greyed out.
When I look in windows explorer I see my file with the little pen icon overlay. When I right-click and go to "Team Foundation Server", I choose undo but then get the message "There are no changes to undo in the selection or any children of the selection". If I right-click and go to Check-In then I get the message "no pending changes".
When I open source control explorer in Visual Studio it shows no pending changes for the file.
Can anyone please advise any steps I can take to resolve?
Can it be that the file is checked out by you on another workspace? Go to VStudio & check "Team Members" under Team Explorer. Right-click on yourself & select "Show pending changes". This should show all your checked out items, across all workspaces/worstations. You can also undo it there.Eventually, in order to find out what is happening with your file go in VS to"File">"Source Control">"Find in Source Control">"Status"Select the path to your module & hit 'find'. This should reveal if any other person has this file checked out
Seems strange, lets check common scenarios:
File is actually not checked-out but shown as checked-out in explorer
=> Please try to checkout file through VS, if you can, there is definitely some problem in Power Tools integration to Source COntrol. Restart machine. If problem is same then it might be case TFS credentials are different from Login windows credentials, status don't update sometimes.
File has set property of single check out by Admin & checked- out by anyone else thus preventing you from either check-out or check-in also undo checkout is not possible for same reason.
Create new workspace or try on other machine with different workspace.
=> Some times workspace conflicts, multiple mapping of same directory through multiple workspace creates problems.
Power Tools installation is corrupted or incompatible with some other extension.
=> Many a times, frequent abrupt power-off or etc corrupts software, reinstall latest Power tools. If problem persists, check if some other extension for VS or windows shell is not interrupting functioning.
Hope that helps, if not, let me know with more details like installed extensions, power tools version/ update installed.
As the resident TFS admin, on occasion I am asked to undo a checkout (usually a lock) that a user has on a certain file checked into source control.
How do you undo another user's checkout?
There are at least 2 different ways to do this:
Command Line
There is a command-line utility called Tf.exe that comes with Team Explorer. Find the documentation here. It can be accessed by launching a Visual Studio Command Prompt window. The syntax of the command is:
tf undo [/workspace:workspacename[;workspaceowner]]
[/server:servername] [/recursive] itemspec [/noprompt]
For one file
tf undo /workspace:workspacename;workspaceowner $/projectname/filename.cs
GUI
The second is via the GUI, but does not come standard - you have to install the TFS Power Tools. See here for details on how to use this method.
Keep in mind that with either method you will need the appropriate rights. The permissions are called "Undo other users' changes" and "Unlock other users' changes". These permissions can be viewed by:
Right-clicking the desired project, folder, or file in Source Control Explorer
Select Properties
Select the Security tab
Select the appropriate user or group in the Users and Groups section at the top
View the "Permissions for [user/group]:" section at the bottom
Deleting the workspace
tf workspace /delete WorkspaceName;User
/server:http://server:8080/tfs/MyTeamCollection
The easiest way I found is to use the free TFS Sidekick application. It has an option to view and undo other user's checkout.
I just had this problem myself and found an easier way to clean up old workspaces.
In Visual Studio, open Source Control Explorer.
From the 'Workspace' drop-down select 'Workspaces...'
A dialog will appear showing the workspaces on your current PC. Select 'Show remote workspaces'
You will now also see workspaces from your previous PC (as long as they are from the same user account). Select the old workspace(s) and click 'Remove'. This should delete the old workspace from from TFS along with any persisting checkouts.
I'm sure Arne has found a solution but I hope this helps others who google the issue.
Select your file in TFS sidekick, then above the list, you have a "undo pending Change". Click on that and the change will be undone :)
The icon is similar to the "Undo" icon in MS word
Get TFS sidekicks from http://www.attrice.info/cm/tfs/index.htm