What are “Excluded Changes” in Team Foundation Ser

2019-02-16 07:18发布

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?

2条回答
三岁会撩人
2楼-- · 2019-02-16 07:45

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.

查看更多
Luminary・发光体
3楼-- · 2019-02-16 07:46

There are a number of things that can cause a "change" to be excluded:

  1. Team Explorer will, by default, ignore files in obj/* and bin/* and a few other folders. As well as certain extensions like .csproj.user.
  2. 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.
  3. They're made in a different workspace, again Team explorer assumes you want to check in groups of files that logically make sense.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. The path may previously have been "cloaked" or "unmapped", mapping a folder after the fact doesn't tell Team Explorer to add them.
  9. 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.
  10. 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.

enter image description here

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.

查看更多
登录 后发表回答