Source Control Explorer Shows Pending Changes, But In Pending Changes Window does not show - tfs

In TFS Source Control Explorer it shows pending changes (edit,[more]) with my name, but the Pending Changes window does not show any pending changes.
What I thought is, months ago my Visual Studio crashed, and at that time some files were checked out (which I was not aware of, due to the automatic checkout nature of TFS). Due to that, I copied a new VMImage, without undoing the pending changes (which are currently showing in Source Control Explorer).
One of my team members wants to checkin a new version of that particular file. Now, I need to undo my pending changes.

It sounds like you have them checked out under a different workspace. Try going to View->Other Windows->Source Control Explorer, then open the Workspace dropdown near the top of the screen, and select "Workspaces..."
I would suggest simply deleting any extra workspaces shown.

Steps to reproduce:
Make non-conflicting edits to files in TFS.
Get the latest version of the project from source control.
Sometimes, pending changes will be marked as non-pending and all project files are saved, resulting in no pending changes in the Team Explorer.
Workaround:
Right-click on the solution folder in source code explorer
Select "Compare"
In the search results, manually open files which have been edited/added and save them. This will register them as a "Pending Change" in team explorer.
This is because TFS apparently uses file properties rather than actual text comparisons to register pending changes in Visual Studio.
Tested on: Windows 7, Visual Studio Ultimate 2012.
Additional feedback from my supervisor: "Not sure if it was the issue this time, but that can happen when you disconnect from the TFS server (which sometimes happens without it being obvious). File | Source Control | Go Online usually fixes it (and the option isn’t available if you are online)."

TFS is buggy everywhere. i think you need to check out the parent folder and use TFS power toys to undo all the rubbish unchanged item.
TFS use file property to indicate whether or not a file has change, which sucks the most, and produce tons of usability problem.

If the file that you checked out is not part of the current solution, it might be hidden by the "Filter by solution" toolbar button on the Pending Changes window.

Get your changed files check out for edit

I had the same problem, I re-started VS, opened the solution and all the changes are now being displayed in the pending changes window.

Did you try to checkout the file from the Source Control Explorer view ?
For me, it worked.

I have just had a similar issue in VS2012.
To resolve the issue, I toggled the "Show xxx" dropdown to "Show Solution Changes" and then back to "Show All". The files that were missing from the list then re-appeared.

I was having a similar problem and it was due to the fact that my local version was a "non-version control solution" for some reason! meaning that my local was not really connected to the actual source code on tfs.
fix: Got the latest with override option checked. I know this could be painful if you had a lot of changes made to your local.

I was facing same issue the first answer was really helpfull. But make sure to check "Show Remote Workspaces" if you are working from different computer. In my cases the files where checked in and edited from home computer and it was showing pending changes. Deleting unwanted workspaces helps to solve this problem.

a different workspace on the same machine
a different workspace on another machine
TeamExplorer -> PendingChanges -> Excluded Changes ( I included this only because you didn't specifically mention they weren't there)
especially if you right clicked a node in solution explorer and chose check-in
Filtered based on TeamExplorer Settings #Oliver
Use a Tfs Query to find the pending changes and what workspace they are pending from.
Another option is to permanently or temporarily give them permissions to overwrite your lock. Then he can check-in anyhow.

I've seen this problem. Sometimes when I have the pending changes window in 'flat display mode', it doesn't display my changes. I find if I click the toolbar icon at the top of the pending changes window with tooltip 'Change to folder view', then they display. I think this is a bug in the Team Explorer Client.

sometimes I can not lock a branch because users have things checked out, but when I ask them about it, the pending merges/changes, only folders come up with no objects to change. What's with that?

Related

Complete nuke all changes in visual studio and reset from TFS

I am using Visual Studio 2013. Regarding TFS workflow, there are issues I have when working on a bug or work item, after I am finished, I move the changes into a shelfset for further review, undo my changes by right clicking on the pending changes and clicking undo. The move on to the next issue or enhancement. The shelfsets can be indpendendly reviewed and then applied to whatever branch they are currently needed.
The problem I have is that undoing through visual studio does not completely reset the solution to a completely clean state. There are often orphaned files around or projects that have references to non-existing files or other such problems. I'd like to be able to completely nuke and reset my solutions from source control as if I am a new developer and I have not found an easy solution to do this.
Currently, the only way I can accomplish this is to go to "Source Control Explorer" remove the file system mapping for the project. Go to the file system, removed the folder. Go back into "Source Control Explorer" add the mappings back in. And then "Get Latest Version".
Is there an easy way to completely reset a solution in Visual Studio with TFS?
You can achieve this in Visual Studio 2010 without Power Tools. Process is likely similar for other VS versions.
Open the Source Control Explorer. Right-click the entry you want to reset, then choose "Get Specific Version." Select the version you want to reset to. Ensure that the two checkboxes are checked:
☑ Overwrite writeable files that are not checked out
☑ Overwrite all files even if the local version matches the specified version
This will overwrite all locally mapped files with the server's version. (And will correspondingly take time proportionate to the number of files.) I do not believe that this operation will remove any unmapped files.
If you have the Power Tools installed, call tfpt scorch /deletes /recursive /diff. That should make your local folder match the server exactly.
You can also call tfpt treeclean, which will just delete any item that is not mapped to TFS. It won't update or replace any changed files though, like scorch will.

Why do all my files have a red check next to them when I "check out latest" for the first time from TFS?

I'm going into TFS and creating a mapping to a local folder, then I right click on the folder I want to check out and click on "Get Latest Version". After I have pulled down all the files I open up the solution in VS and in the Solution Explorer window I see all the files (including the solution and project files) have red check boxes next to them. So now it looks like they all need to be checked in because I have made edits! This is not true, I'm checking these fiels out for the first time and haven't made any changes yet.
How do I check out the folder without it looking like there are already edits that need to be checked in? (no red check next to each file)
I had a similar problem (red checks next to everything in the Solution Explorer window). I resolved it by selecting the solution in the Solution Explorer, and then selecting from the menu bar: File > Source Control > Refresh Status. This removed all my red checks.
In Team Explorer (in Visual Studio): Tools | Options | Source Control | Visual Studio Team Foundation Server and select Show Deleted Items...
Then in source control explorer you'll see the items greyed out. You can right click on them and Undelete. (This option will only be available if they, after the undelete, will be included in your current workspace).
The red check marks indicate that there has been a change to the file. Many of these answers for previous versions of Visual Studio seem correct. I use Visual Studio 2017 and using GitHub.
If you have several files with the red check mark:
Right click project
Go to Source Control,
Select Commit,
{Follow standard commit procedure}
Enter your commit message,
Sync,
Push.
If there is just one file or you want to commit the files individually:
Right click each file
Select Commit,
{Follow standard commit procedure}
Enter your commit message,
Sync,
Push.
Right click project
Right click file
Identify Version Control Item Status in Solution Explorer
Checked out
Represents an item for which the current user has a pending change in their current workspace, and the item is not exclusively locked.
For me, the red X's were appearing because I had moved the files from a Feature branch to an Archived branch (After a successful merge into the main branch).
I tried File > Source Control > Refresh Status however this didn't help.
I didn't want to go messing with cache files.
I found this answer:
Go to Tools/Options/Source Control/Visaul Studio Team Foundation Server. Check if there is a check mark next to "Show deleted items in the Source Control Explorer".
I had to right click the particular folder and selected the "Source control" ->"undo pending changes" option.
Just spent 4 hours trying to rectify this and none of the solutions above worked for me, not even unmapping and re-mapping the solution.
In case anyone still has this problem, try removing your workspace and re-adding it.
Below are the instructions for removing and re-adding a workspace in Visual Studio 2019, but it should be similar for any other version as well:
Go to Team Explorer, scroll down and under Solutions you will see
Workspace: "Name of your workspace"
Click on the arrow next to it and select Manage Workspaces
A dialog box containing your workspace will open. Click Edit to see
the paths for Source Control Folder and Local Folder. Make a note of
them as it will be useful for re-adding the workspace. Close the Edit
Workspace window, select the Workspace and press Remove
Once it is removed, select Add then enter the paths that you noted
earlier. Press OK to confirm and it should re-add your workspace
without the check marks.
In Visual studio 2019, I have unloaded the project and I have reloaded the project. Then it went.
Working solution tested. It turned out very easy. Pending Add + sign or Pending Edit red check sign statuses on projects (below screenshot) of solution are git's statuses, this is very normal, and they will be disappeared after you "git add ." and "git commit -m 'messages'". Done!
After banging my head against a brick wall for 4 hours, it turned out I didn't want to delete the folders and files in the Source Control Explorer with the red X alongside them I had previously deleted, but merely toggle the Show/Hide Deleted Items button so it made them all disappear:
Highlight the adulterating red-crossed folder/file, and click the 2nd icon from the left in Source Controller menu that looks like an 'Xx'. For me, that's all I wanted to do. My offending files had actually been physically deleted from everywhere except from the documentary evidence that they had once been in the Source Controller. That sorted it for me.

How to undo pending changes in TFS of users that no longer exist

We have a few developers who don't work here anymore, but didn't check all theirs changes into Team Server before they left.
Now their usernames don't exists anymore, and I can't access their pending changes to undo them....
I found a way, not needing command line.
With Power Tools installed (both in 2008 and in 2010 version), Visual Studio shows a node for Team Members in each project. If you right-click on one of the members, you can choose to view all their pending changes. Till now nothing new. BUT, I suddenly saw, in the right hand upper corner of the pending change list, a link that says "Modify Query".
I opened the window, and in it was an input field that let me change the username. I changed it to the username I wanted, and I got his list of pending changes!
Here's a link to the TFS 2008 Power Tools:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=FBD14EEA-781F-45A1-8C46-9F6BA2F68BF0
and the TFS 2010 Power Tools:
http://visualstudiogallery.msdn.microsoft.com/en-us/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
Edit by woppers:
I don't have enough Rep to comment so I have to make an edit. I had the same issue as the OP but I am working in TFS 2013 so the procedure is slightly different. Here's what I did.
Go to:
Source Control Explorer
right click on the collection you are working in
Find
Find Changesets...
Enter your LanID in the “By user:” field
Click search
Click find
That will show you all of your pending changes.
Highlight one of them and click “Details...” to view the info in them.
As an administrator of TFS you should have some option of global check in.
something like that in the command line: tf lock /lock:none /workspace:workspace;username $/code/foo.cs /s:http://server:8080
or better yet:
tf undo /workspace:workspace;username $/code/foo.cs /s:http://server:8080
To expand a bit on the awesome answer provided by xr280xr... I needed to undo pending changes of a former employee, and this worked for me on a TFS 2013 server, using VS2015 on my own desktop:
Right click the folder in Source Control Explorer > Find > Find
by Status and enter * as a wild card. You can reduce the results to
a specific user if you know the user name.
When the results appear, you can right-click and select Undo. The
Output window should confirm success.
Note that if the former employees' workspace is on another PC, you'll continue to see the pending changes they have, but they will no longer prevent checkout, build, etc.
I'm guessing that deleting the former employees workspace will get rid of the pending (now-undone) changes, but I haven't tried it yet.

Visual Studio loses track of pending changes after unshelve

Yesterday I worked on a set of changes I don't want to check in yet, and at the end of the day, decided to shelve my changes. The changes included a bunch of added files. The shelving worked fine, but today when I unshelved, the following happened:
VS told me four writable files already exist in my workspace. These files were the ones I added
I told VS it's all good, overwrite them and we're set
VS finished the unshelve...
... but left the "pending changes" tab empty.
I figured maybe something went wrong and re-tried the unshelve. At this point VS proceeded to tell me I've got pending changes in my workspace. So now I can't check in, can't unshelve and apparently the files are locked for edit under my name (yes, we use the lock-modify-unlock mode, unfortunately). What gives, and how do I fix it?
Edit: Upon further inspection, Source Control Explorer doesn't show pending changes from me, so apparently it's just my workspace that's borked. Correction: yes, it does, I was just looking at the wrong branch, aargh!
Edit 2: tf.exe does show the changes. I tried to undo them, delete the files that were still in the workspace (the ones that caused first VS error) and unshelved without errors. For a short while VS displayed the pending changes, but when the operation completed, they all disappeared.
OK, I'm just full of stupid today. The shelveset I was working with didn't belong to the branch I had open. Opening the project from the correct branch miraculously shows the changes in the pending changes tab!

TFS shows some pending changes under my name, but I have not changed anything

TFS shows some pending changes under my name, but I have not changed anything. When I check in and see View Pending changes, I see some of the changes which I have never made, changes pending under some other user might be shown as my pending changes. When I unselect and check-in my changes, these are still locked under my name? Is this due to auto-checkout or any other reason? (TFS policy requires a compile before check-in)
This is probably due to the automatic checkout feature in TFS.
TFS uses an atomic check-in process and is very careful about recording who did what. When you start editing a file (or the IDE edits one on your behalf, for example a .csproj or .vbproj file) then the file will show up in your pending changes list to show you that you have the file checked out with an edit pending.
To see your pending changes list, go to View, Other Windows, Pending Changes in Visual Studio.
To check-in any pending changes you can right click on the file in solution explorer or you can select it in the pending changes view. Only then will the change be committed into version control. From the pending changes view you can compare with the server version to see what changes you have made.
To see the changes that have been committed to the server you can right click on a file or folder and select "View History".
If you want to remove the pending change and restore the file to what it was before you edited it you can right click on the file and select "Undo Pending Changes".
If you want to change the auto check-out behaviour to prompt you before it performs a check-out, then go to Tools, Options, Source Control, Environment and change the Checked-in items for Saving and Editing to "Prompt for check out" rather than the default which is "Check out automatically".
Hope that helps,
Martin.
I've had a similar issue; TFS still says I've got pending changes that when I compare declares as being identical. This post comes up with a way to prune out all the identical ones and to leave you with only the files that actually have changed.
The problem might have to do with different workspaces that you use or have used possibly on different computers. Check the workspaces that exist and see if the files are checked out anywhere else. Here the sidekick tool mentioned in a comment can help.

Resources