How to unlock a file from someone else in Team Foundation Server

后端 未结 12 873
臣服心动
臣服心动 2020-12-01 01:01

We have a project that is stored within our TFS server and some files were Checked-Out by me from another computer and another user (both of which are not used anymore). Is

相关标签:
12条回答
  • 2020-12-01 01:33

    I was able to undo another user's checkout with the following command:

    tf undo {file path} /workspace:{workspace};{username}
    

    You'll need to wrap that semicolon in double-quotes if you're running the command from PowerShell. We're running TFS 2010 (and VS 2010).

    Disclaimer: I got this from the FCI-H blog at http://fci-h.blogspot.com/2011/01/how-to-force-undo-checkout-tfs.html

    0 讨论(0)
  • 2020-12-01 01:33

    Team Foundation Sidekicks has a Status sidekick that allows you to query for checked out work items. Once a work item is selected, click the "Undo lock" buttons on the toolbar.

    Rights

    Keep in mind that 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:

    1. Right-clicking the desired project, folder, or file in Source Control Explorer
    2. Select Properties
    3. Select the Security tab
    4. Select the appropriate user or group in the Users and Groups section at the top
    5. View the "Permissions for [user/group]:" section at the bottom

    Screenshot of unlocking a file using Team Foundation Sidekicks

    Disclaimer: this answer is an edited repost of Brett Roger's answer to a similar question.

    0 讨论(0)
  • 2020-12-01 01:36

    Here's what I do in Visual Studio 2012

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

    1. From the Source Control Explorer find the folder containing the locked file(s).
    2. Right-click and select Find then Find by Status...
    3. The "Find in Source Control" window appears
    4. Click the Find button
    5. A "Find in Source Control" tab should appear showing the file(s) that are checked out
    6. Right click the file you want to unlock
    7. Select Undo... from the context menu
    8. A confirmation dialog appears. Click the Yes button.
    9. The file should disappear from the "Find in Source Control" window.

    The file is now unlocked.

    0 讨论(0)
  • 2020-12-01 01:38

    Team Foundation Sidekicks worked fine for me.

    The file didn't unlock so I did a undo on pending changes and after that I could delete the file.

    0 讨论(0)
  • 2020-12-01 01:39

    Based on stackptr answer I've created batch file UnlockOther.bat

    @rem from https://stackoverflow.com/questions/3451637/how-to-unlock-a-file-from-someone-else-in-team-foundation-server
    @rem tf undo {file path} /workspace:{workspace};{username
    
    call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
    @echo on
    tf undo $/MyTfsProject/path/fileName.ext /workspace:CollegeMachine;CollegueName /login:MyLogin 
    @pause
    
    0 讨论(0)
  • 2020-12-01 01:43

    Use the unlock command that comes with TFS

    1. Click Start, click All Programs, click Microsoft Visual Studio 2008, click Visual Studio Tools, and then click Visual Studio Command Prompt.
    2. Type the following command and replace the arguments with the appropriate parameter information for your needs: tf lock /lock:none $/MyTeamProject/web.config

      tf lock itemspec /lock:(none|checkout|checkin) [/workspace:workspacename] [/recursive] [/login:username,[password]] [/collection:TeamProjectCollectionUrl]

    From MSDN.

    0 讨论(0)
提交回复
热议问题