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

  • How to make a script to perform git pull?
  • Git “unable to determine absolute path of git directory”
  • How to 'git remote add' and track a branch in the same filesystem
  • git-pull: could not detach HEAD for Unicode filenames
  • How to undo all git commits done today?
  • what is the best way to work across multiple machines with git?
  • including several git projects in one, simple example
  • Amend a past commit (remove files from more than one recent commit)
  • Git pull not pulling everything
  • How to rebase off master with github client?
  • how do i create/import a clojure project from github in netbeans?
  • symbolic link to specific git reference
  • 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 git add.

    Two possible solutions:

    1. temporarily take them out of your .gitignore, then
      git rm --cached -- *.mdf and
      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 .gitignore.

    2. If you don’t want to play around with your .gitignore, you could use update-index:
      git update-index --assume-unchanged -- *.mdf and
      git update-index --assume-unchanged -- *.ldf.
      This will force git to see the files as unchanged even if they were.

    Git Baby is a git and github fan, let's start git clone.