简体   繁体   中英

Visual Studio 2019 - Find items not in source control in Solution Explorer

Is there a way to filter the files in the Solution Explorer such that I only see items that are not included in source control ? I don't mean I want to see hidden files; I only want to see files that are included in the solution but are not a part of source control. You can usually tell these files because they are missing the little lock icon next to them, but I would like a way to filter to see only those files.

I ask because. . .

If I'm switching between projects or tasks, I like to create shelvesets to save any current progress, then right-click > Undo... to get rid of any pending changes. In .NET Framework projects, this both removes pending changes as well as excludes from the project any brand new files I may have created; unfortunately in .NET Core, this removes pending changes, but any new files I may have created are still included in the project , even though they're excluded from source control. This usually causes all sorts of build problems until I delete or exclude these files by hand, and I have to comb through my project folders to find them all (or build and rebuild and rebuild to see where the lingering errors occur). This is a PITA, so I am hopeful there's some easy way to do what I want.

I am afraid there is no such out of way to achieve this with Solution Explorer directly.

I would like provide you a workaround based on the source control type, git or TFVC.

If you are using TFVC, you could try to use the Source Control Explorer (View->Other windows -> Source Control Explorer) in VS, which has a button on its toolbar to compare folders. This allows you to compare the folder in source control with the folder on disk, including files that exist only on either side, or files with differences.

If you are using the git, you could use the git command line git status to get those untracked files. You could check this thread for some more details: How to tell if a file is git tracked (by shell exit code)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM