Visual Studio gitignore and mdf, ldf files
I have a database project that generates these files and added to gitignore. However they don’t seem to be getting ignored and I need to revert them before commiting, quite annoying. The files are still locked by VS, is this a problem?
# # Windows and Mac OS X Temp Cache Files # [Tt]humbs.db *.DS_Store # #Visual Studio files # *.[Oo]bj *.user *.aps *.pch *.vspscc *.vssscc *_i.c *_p.c *.ncb *.suo *.tlb *.tlh *.bak *.[Cc]ache *.ilk *.log *.lib *.sbr *.sdf *.dbmdl *.mdf *.ldf *.Database.dbmdl ipch/ obj/ [Bb]in [Dd]ebug*/ [Rr]elease*/ # #Tooling # _ReSharper*/ *.resharper [Tt]est[Rr]esult* # #Project files # [Bb]uild/ # #Subversion files # .svn # # Microsoft Office Temp Files # ~$* # # YoureOnTime specific files # YoureOnTime.Database.dbmdl # End of File
One Solution collect form web for “Visual Studio gitignore and mdf, ldf files”
I need to revert them before commiting
indicates that they are already versioned and were entered into
.gitignore after they were added using
Two possible solutions:
temporarily take them out of your
git rm --cached -- *.mdfand
git rm --cached -- *.ldf.
This will remove the files from the index while keeping them on disk. When done,
git commit -m "removing crap from repo"and restore your
If you don’t want to play around with your
.gitignore, you could use
git update-index --assume-unchanged -- *.mdfand
git update-index --assume-unchanged -- *.ldf.
This will force git to see the files as unchanged even if they were.