Reputation: 1097
I have been using git in Visual Studio 2015 (VS2015) for over a year. When I started doing UWP development in VS2015 and now in Visual Studio 2017 (VS2017) I notice that Visual Studio wants me to check in all kinds of ../bin/.. and ../obj/.. files that are created and updated by every re-run of my unit tests, every recompile, etc.. These folders are in my .gitignore file which command-line git sees and respects (as long as the files haven't already been checked-in).
Is VS2017 ignoring the .gitignore file; specifically when UWP files are being worked with (I have only done UWP work in VS2017)?
Is there some setting I missed in VS2017 that causes the editor to read or better yet create an appropriate .gitignore file?
How do others avoid noisy check-in requests when working with VS2017+git+UWP?
Upvotes: 1
Views: 975
Reputation: 471
As mentioned by @rfreytag, once a file is tracked it is excluded from the .gitignore so Visual Studio continues to track changes to that file.
However, you can get around this by using a git rm --cached
command after uploading the .gitignore file. See the example on codeblocq.com.
To summarize the example, I recommend you grab the latest Visual Studio .gitignore file (found at this git repository), add it your git repository's origin master, remove all files from git tracking using the command git rm -r --cached .
(I would definitely save a copy to another location prior to the remove command to be safe but the --cached
option should only remove the .git metadata and leave the physical files on your machine), and add all the files back to git with the command git add .
. Once this has been completed, Visual Studio will correctly ignore files in the .gitignore.
Upvotes: 2
Reputation: 1097
Once a file is tracked it will be flagged by 'git status' irrespective whether or not the file extension is excluded by .gitignore. Rebuild the repository starting with .gitignore and the repository will correctly flag only the essential files.
Upvotes: 0