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

#Visual Studio files


#Project files

#Subversion files

# Microsoft Office Temp Files

# YoureOnTime specific files

# End of File

  • Https certificate errors for GitHub using git on Windows 7
  • pip: pulling updates from remote git repository
  • Pushing to Hosted project above webroot
  • Git - Remove in between commit
  • Add a subdirectory of another project as a subtree
  • Rename remote branch
  • git remove commit from a merge
  • git error “unable to write sha1 filename … Permission denied”
  • How to write a good Git commit message?
  • Reverting a submodule with Git
  • Why does git's design distinguish between “ignored” and “untracked” files?
  • “Updates were rejected because the tag already exists” when attempting to push in SourceTree
  • 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.