visual-studio-2010 - Visual Studio gitignore 和 mdf、ldf 文件

标签 visual-studio-2010 git gitignore

我有一个生成这些文件并添加到 gitignore 的数据库项目。然而,它们似乎并没有被忽略,我需要在提交之前恢复它们,这很烦人。文件仍然被 VS 锁定,这是一个问题吗?

#
# 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

最佳答案

I need to revert them before commiting

表示它们已经被版本化并被输入到 .gitignore 之后它们是使用 git add 添加的。

两种可能的解决方案:

  1. 暂时将它们从你的 .gitignore 中取出,然后
    git rm --cached -- *.mdf
    git rm --cached -- *.ldf.
    这将从索引中删除文件,同时 keeping them on disk .完成后,
    git commit -m "removing crap from repo" 并恢复你的 .gitignore

  2. 如果你不想玩弄你的 .gitignore,你可以使用 update-index :
    git update-index --assume-unchanged -- *.mdf
    git update-index --assume-unchanged -- *.ldf.
    这将强制 git 将文件视为未更改,即使它们是未更改的。

关于visual-studio-2010 - Visual Studio gitignore 和 mdf、ldf 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11792461/

相关文章:

visual-studio - Visual Studio 任务列表

visual-studio-2010 - 401 在 MS Web 部署上

git - 如何 check out 远程分支git?

git - 单个 git-svn 命令不为多个 svn 操作缓存密码

git - Visual Studio Code 不支持 git 选项卡中的 .gitignore

c# - 将一些dll编译成另一个dll

c++ - 错误 C1189 : #error : This file requires _WIN32_WINNT to be #defined at least to 0x0500. 建议使用值 0x0501 或更高

python - Bash 或 Python : How to download a single specified file from Github?

git - 为什么 .gitignore 不起作用?

android - 无法在 Android Studio 项目中添加模块,同步选项也不可见