.gitignore ignored Visual Studio?

I have a git project that I use to use Visual Studio 2013 and Git.

I noticed that many, if not all, of the files listed in my file .gitignore , still displayed as pending changes in the window Team Explorer.

However, when the git status using bash, I can not see the files (as you would expect). Why is this happening, and more importantly, how can I get Visual Studio to process my file .gitignore just like git bash?

.gitignore file:

GitIgnore file

Window pending changes (Team Explorer):

Pending changes window

+6
source share
3 answers

I had the same problem with linked files. Team Explorer argued that add related files, so I added them all to .gitignore . git status is now clean, but the Team Explorer continued to show these files as added.

Right-click the list of files in the changes in Team Explorer and select "Undo", it seems to have worked. The files themselves have not been removed and they were removed from my list changes.

It seems, Team Explorer simply does not immediately receives changes .gitignore . Hope this helps.

+4
source

To make Visual Studio 2013 include the changes made to the file .gitignore, delete the file ms-persist.xml in the folder with your decision .git.

+3
source

I want to share my experience very similar to Visual Studio 2017, although in my case git from the command line was not confirmed by the files listed in my .gitignore .

I used Powershell to create my file .gitignore with the command echo '' > .gitignore . This created a file encoded in UCS-2 LE BOM instead of UTF-8. As a result, git will display the file in git status , but none of the files were not ignored, until I reworked it in UTF-8. So ... be careful when creating an empty file with such a Powershell command as I would like to get into the UTF-16 dungeon.

As mentioned in another answer , I had to use a command like echo '' | Out-File .\.gitignore -encoding Utf8 echo '' | Out-File .\.gitignore -encoding Utf8 Utf8 for the initial creation of a file, even though it creates a file with the UTF-8 specification,

In addition, the following command, as I learned of another answer , copy the contents of the file and creates a new file with only the usual UTF-8 without specification:

 Get-Content -Encoding utf8 .\.gitignore.bak | Out-File -Encoding utf8 .\.gitignore 
+1
source

All Articles