Search code examples
tfstfs-power-tools

How to handle missing 'added' files during check-in


I have a bunch of files in the 'added' state across many folders that were accidentally deleted from the file system. How can I easily either undo them or convert all of them to a 'delete' status? I'd prefer not to have to manually undo each file one at a time.

What I've tried so far:

  • In the Pending Changes window, using the Undo command for each missing file is tedious. Since the window does not identify which files are missing, I have to compare this window to the file explorer and compare the contents of each folder.
  • The answers for this similar question don't apply to me because my files are in the 'added' state, so comparing my workspace to the server will not identify these missing files.
  • I've looked through the TFS Power Tools for something to identify missing files but haven't found anything that directly addresses missing files.
  • The tfpt online command doesn't address missing files in the 'added' state.

Solution

  • If I read you correctly, in this case your underlying file system and what TFS thinks is on your file system have gotten out of sync.

    The best, easiest, way I know how to rectify this is to undo all your changes, then redo the adds, deletes, and edits that you actually require. I know that with many files this will be a pain, but let me reiterate: I mean the best, easiest way and not the fun, effortless way (which I don't think exists)!

    Do a 'clean' in your project within Visual Studio, then delete any bin/ and obj/ folders in the source.

    Then undo all changes for your project.

    If you are using TFS < 2013, I would recommend the use of Team Foundation Power Tools online functionality. For instance:

    cd \dev\path\to\project\root\
    tfpt online /adds /diff /deletes /recursive .
    

    Otherwise, if you are using TFS 2013, then you can use the built-in 'reconcile' functionality (cannot find a web URL for this, the 2010 docs are incorrect, use 'tf reconcile /?' for a description):

    cd \dev\path\to\project\root\
    tf reconcile /adds /deletes /diff /recursive /noignore /promote .