'GIT when saving file changes are lost

I have a GIT repository set up with visual studio and committing and syncing goes fine when I pull a branch. However when I restart my computer the changed suddenly start to do odd.

If i edit a file and do not save it I can commit the changes within visual studio. However if I hit "ctrl + S" it suddenly marks it as up-to-date and forgets all the changes i made. not though that the changes in the file are still there.

A workaround I have been using but which is utterly cumbersome is to close the edited file, reopen it add a space and commit it.

If i recreate a new local branch it will work again for another day. but once the computer restart i get the same problem.

Does anyone know why GIT + visual studio would be doing this? thanks in advance.



Solution 1:[1]

It turned out to be an issue in the Git ignore file which wasn't excluded. So if you have a .gitignore file make sure it doesn't get send to the repository.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rodney Wormsbecher