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
Open Visual Studio and the solution needing an ignore file. From the top menu select Git > Settings. The above will open Visual Studio's Options with Source Control > Git Global Settings selected. From the list on the left select Git Repository Settings and then click the Add button for Ignore file.
In the Visual Studio, click Git > Settings. This opens the Options window. Navigate to Source Control > Git Repository Settings. In the Git files section, click Add (next to Ignore file).
MDF stands for Main Database File and contains all the information in a database. LDF records all the transactions and changes to the database. The ldf is critical for disaster recovery.
Open Visual Studio and the solution needing an ignore file. From the top menu select Git > Settings. The above will open Visual Studio's Options with Source Control > Git Global Settings selected. From the list on the left select Git Repository Settings and then click the Add button for Ignore file.
In Visual Studio 2015 Team Explorer > Local Git Repositories > Project > Settings > Git > Repository Settings > Ignore & Attribute Files.You can add .gitignore file with items should be ignored in visual studio solutions by default.
You can create or edit your .gitignore file for your repo by going to the Settings view in Team Explorer, then selecting Repository Settings. Select Edit for your .gitignore. It automatically creates filters that will ignore all the VS specific build directories etc. More info have a look here. Show activity on this post.
At least some Visual Studio versions auto-generate .manifest files when none is specified explicitly, therefore we used to ask Git to ignore them. However, we do have a beautiful .manifest file now: compat/win32/git.manifest, so neither does Visual Studio auto-generate a manifest for us, nor do we want Git to ignore the .manifest files anymore.
In the Visual Studio, click Git > Settings. This opens the Options window. Navigate to Source Control > Git Repository Settings. In the Git files section, click Add (next to Ignore file ).
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:
temporarily take them out of your .gitignore
, thengit rm --cached -- *.mdf
andgit 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
.
If you don't want to play around with your .gitignore
, you could use update-index
:git update-index --assume-unchanged -- *.mdf
andgit update-index --assume-unchanged -- *.ldf
.
This will force git to see the files as unchanged even if they were.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With