I am using Visual Studio 2107.
Looking at the “Pending Changes” panel in Team Explorer, there are two list for “Included Changes” and “Excluded Changes”.
I can use the Filters option to display only files that match a certain pattern. However, I want to be able to hide files that match a certain pattern.
The reason is that I have a number of files regenerated during the development process; these files all have the same name in different projects. They clutter up the list when I am reviewing what to check-in.
Note that I don’t want to exclude these files from being checked-in; they will be checked-in to source control eventually. I just want to be able to review the Changes list without these files displayed until I want to see them.
It seems straightforward but I can’t seem to figure out how to do it. And I can’t seem to find the right phrasing for Google.
How do I hide files in Team Explorer Pending Changes View?
If you don’t want to exclude these files from being checked-in, I am afraid you could not hide files in Team Explorer Pending Changes View.
According to the document Develop code and manage pending changes:
Almost every change that you make to the files on your dev machine is
stored in your workspace as a pending change until you check it in.
If items that you don't need to check in appear regularly in the
Promote Candidate Changes dialog box, you can select one of them, open
its context menu, and choose Ignore this local item to ignore the
item. You can also choose Ignore by extension or Ignore by file name
to create a file that will cause Visual Studio to systematically
ignore this kind of file.
So, Pending changes will detect all your changed files unless you don't want to check them in.
So, to hide files in Team Explorer Pending Changes View, we need to use .tfignore file to ignored files to folders that are mapped in a local workspace, they do not appear in the Pending Changes page in Team Explorer. When you want to check them into source control, you can move them out from .tfignore file.
Hope this helps.
Hiding files from Pending Changes is not supported without fully ignoring them.
Related
I have a situation where a developer made mass changes to a project outside of TFS (long story), and now we want to put those changes back into TFS (files added, removed, renamed).
Of course, TFS is not like Git; if I check out the project, then delete the files from the workspace and copy over the new files, TFS won't adapt to those changes.
I have discovered that I can do a Compare from File - Source Control, and that the Compare screen allows me to mark files as added/deleted. This helps, but is a slow process for a large project, and quite prone to human error.
So, my question is: Is there an automated way to get TFS to simply add all new files and remove all deleted ones?
I don't care about tracking history of renamed files--they can be
considered "removes" and "adds."
I have tried unbinding and rebinding the workspace; this did not work for me (or I didn't do it correctly).
I am using VS 2015, TFS 2015, and I have the TFS Power Tools.
If you are using a Local Workspace then you should be able to get latest on the workspace, then copy over all the new files in Windows Explorer which will generate pending changes and file adds.
If you go into Pending Changes in Team Explorer you will have lots of detected changes for new files etc. but you can promote them to included changes.
This isn't going to deal with file renames or deletions though so it might not be the best solution.
Alternatively you could use Reconcile Changes in Version Control
In Source Control Explorer, right-click a folder, and then click Compare.
In the Compare dialog box. select the folder versions to compare.
In the Folder Difference window, right-click the folder or file you want to reconcile, and click Reconcile.
This will allow you to choose what to add or change to version control
You might try using tfpt online. I would add the /adds /deletes /diff /recursive flags as well.
I think in almost any case you will have some conflicts/manual work to do here.
There is a blog post on a possibly similar situation that used tfpt online as well: Discover File Changes Made Outside of Visual Studio
Since I did not get to try the above suggestions, I'll post the workaround I did, in case it helps anybody else. Hopefully, the above suggestions are better than what I ended up doing.
Make sure nothing is checked out
Open solution
Team - Go Offline
Close solution
Windows Explorer - Copy latest source folder into the current source folder (Windows Explorer will do a Merge).
VS - Open solutin, select solution file
File - Source Control - Advanced - Change Source Control
if you get a message about unloaded projects, make sure all projects loaded. Click "Reload" on those that didn't.
Shift to select all project, click Bind
Do a Compare in Source Control Explorer. Manually add all new files. Manually delete all deleted files. Frown.
When I check in changes in TFS Express 2013 using Visual Studio 2013 Professional, there is a list of "Excluded Changes" that has 1541 items in it.
I have never told TFS to exclude a change, and do not understand why anyone would even want to "exclude" a change (isn't source control all about SAVING changes???). I am a bit worried that I have changes that are not being saved...but am even unsure if this is even what it means. I have Googled for more information about "Excluded Changes" in TFS, but haven't found any explanation.
Can anyone explain to me: What are Excluded Changes? Why would I want to exclude a change? And why are there 1541 excluded changes that I never requested to be excluded? Should I be worried that changes are being excluded? Should I change these excluded changes to INCLUDED changes?
There are a number of things that can cause a "change" to be excluded:
Team Explorer will, by default, ignore files in obj/* and bin/* and a few other folders. As well as certain extensions like .csproj.user.
They're not loaded in your current solution, so Team Explorer assumes they're made as part of either a different solution and that you don't want to check them in together with the changes that do match the context you're in.
They're made in a different workspace, again Team explorer assumes you want to check in groups of files that logically make sense.
They're manually excluded from the current checkin. You may do that when you want to first check in one file that fixed Bug 123, then check in another set of files that fixed Bug 124.
Files created outside of Visual Studio are never automatically added, so when you zip up a set of .cs files and that zip ends up in your workspace folder, Team Explorer will detect it, but won't add it automatically.
There is a final issue that may be going on here, if for some reason a project hasn't been added to source control, or the bindings in the solution file were not checked in correctly, then any file added to that project will be ignored as well, as Visual Studio assumes that project should not be under sourcecontrol.
Using "Add existing project" doesn't automatically put that project under the same source control bindings as the solution. which would cause team explorer to assume 6.
The path may previously have been "cloaked" or "unmapped", mapping a folder after the fact doesn't tell Team Explorer to add them.
You may have been working offline and were using a server workspace. When you tell Team Explorer to come back online, you need to ensure that all adds are correctly done. A Local workspace doesn't have this issue, as it can locally track the changes without having to talk to the server.
You may have chosen "Check in pending changes" from a subfolder in the Solution Explorer (or on an individual item or project) or in the Source Control Explorer. When you do that, Team Explorer scopes the Pending Changes window to only the items that match that context. All other changes are temporarily moved to the "Excluded Changes" section.
You should inspect the Excluded Changes list and either ignore them using your .tfignore file. You can do this from the UI as well by right-clicking such an excluded change and choosing the option to ignore by path/extension or pattern.
Basically, if you see stuff in the Excluded Files section, either right-click/include them or add them to your .tfignore file.
That way it's at least very clear that items in that list have not been evaluated yet and most probably need to be included.
You may also want to check your source control bindings by opening File/Source Control/Advanced/Change Source Control Bindings... to ensure that all projects show as bound to sourcecontrol and don't show any errors.
Some additional context
In Git as well as in other source control systems, changes are often not automatically pended. This is to prevent you from accidentally checking in stuff that you did not intend to. In Git you need to explicitly call git add to mark a change as one that you intend to commit. Until you do that the change is considered "untracked", which is essentially the "Excluded Changes" feature of TFVC.
Subversion (SVN) has a similar behavior where changed files are marked as unversioned and need to be added explicitly through calling svn add.
So this isn't very strange behavior for a source control system. It essentially puts you in control of your sources.
Wanted to give another case where files are excluded. If you add a project from template or a new item to your project that includes a default name like "MainWindow" then rename or delete that file before ever commiting changes. "MainWindow" will be in the excluded changes and the item with new name will be in Included changes. In this case you can safely delete them.
I started using TFS Team explorer 2012 and happen to notice a new process called promoting. As I understand it, the Team Explorer detect any changes made to the files outside of the TFS explorer and count them for promotion? Am I right?
How do I take care of the situation where I made a change to the file which is already checked out through TFS, then made a change via Windows Explorer\Notepad but dont want to include the changes made through the Windows Explorer\Notepad.
This is a new feature of TFS 2012 called Local Workspaces.
You are correct in that changes made outside of visual studio can be included in the check-in by promoting them, if they are not already under source control.
If they are already in source control and you do not want to commit them, then you would need to right click the file and choose Exclude. This will move the file from Included Changes into Excluded Changes.
If you do not like the new Local Workspaces you can tell TFS to go back to the old model of Server Workspaces:
Open Team Explorer
Go to Settings
Under Team Project Collection select Source Control
Click the Workspace Settings Tab
Here you can choose the workspace type.
While everything that discens said is correct, one thing bears explicit mention: there is no change to the level of granularity of Team Foundation Server. You still check out files and edit files and check-in files.
In your example, if you have a file checked out and you edit it in Notepad, the changes will be checked in. There is no change here from previous behaviors. There is no way to keep these changes from being checked in, short of saving the file with a different file name.
Scenario:
A solution is checked into TFS. Changes are made to an offline/disconnected/unbound copy of the solution, which becomes "the latest" version. I want to update the repo with this disconnected copy's files.
How do I get TFS to look at all the files and determine which ones have changed, so it can check only those in?
If this were SVN, I would just plop the files on top of the existing working copy, and it would just work.
Do you have another copy of the solution that is bound to TFS? If not, you'll need one. You have two options:
Take the solution "offline" by right-clicking on the solution node and click "Go Offline". You can then copy your changed solution on top of the bound solution. When you load the solution again, right-click the solution again and choose Go Online. This will scan the disk and determine what has changed.
You other options is to run "tf edit" recursively on a bound solution, copy your changed solution on top of the bound one and then run "tfpt uu". "uu" stands for undo unchanged and it will undo changes to the files that are not different.
I cant think of any elegant way off hand but your best option would be to know what files were changed or added offline and connect them to the TFS version while removing the old TFS files.
To do this simply right click all of the old files and either delete them or exclude them from the project then move the new files into their physical folders and replace them with the updated version. If files were added then add them in the correct folders. Finally make sure all files are view-able in the solution explorer by clicking "show all files". Finally, right click the files you changed and select include in project for each.
This way you will have replaced only the files that were changed and won't have to check in the entire solution to TFS making it very unclear what files were changed with your check-in.
I am a lone developer, and I am now using TFS 2010, having until recently used VSS.
I have not found it easy to get any books for beginners to help me use this.
So I have now got my project in source control. But when I check in I get references to a number of files that I no longer use. How do I remove files from the TFS Source Control repository?
So in the example below, you can see lots of files from different projects that I do not want to see.
Click on the last icon that looks like a solution (.sln) file icon (last icon on the top vertical row). It's right next to the refresh icon and just above the "Comment" box. That should clear all non-related project files, and only show the files on your current project.
In Source Control Explorer in Visual Studio, simply right-click on files and folders and choose "Delete". Then right-click again and choose "Check-in pending changes".
You need to Destroy those files first, then only those files will get removed from source control.
You can't make any changes in those files - they remain in source control until you destroy them permanently from TFS.
For more info about how to destroy see TF Destroy command utility.
The files in your screenshot are (mostly) listed as add - they are not in TFS yet, so deleting them from TFS is not what you want. Rather you want to ignore them, though that can be tricky: How to ignore files/directories in TFS for avoiding them to go to central source repository?