让GIT忽略DLL,PDB和类似的生成文件 [英] Make GIT ignore DLL,PDB and similar generate files

查看:552
本文介绍了让GIT忽略DLL,PDB和类似的生成文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题让GIT感到内疚生成的文件



以下是我想要忽略的文件示例

 修改:BLLTarifario / bin / Debug / BLLTarifario.dll 
修改:BLLTarifario / bin / Debug / BLLTarifario.pdb
修改:BLLTarifario / bin / Debug /Corte.Library.dll
修改:BLLTarifario / bin / Debug / Corte.Library.pdb
修改:BLLTarifario / obj / Debug / BLLTarifario.csprojResolveAssemblyReference.cache
修改:BLLTarifario / obj / Debug / BLLTarifario.dll
修改:BLLTarifario / obj / Debug / BLLTarifario.pdb
修改:Corte.Library / bin / Debug / Corte.Library.dll
修改:Corte.Library / bin /Debug/Corte.Library.pdb
修改:Corte.Library / obj / Debug / Corte.Library.csprojResolveAssemblyReference.cache
修改:Corte.Library / obj / Debug / Corte.Library.dll
修改:Corte.Library / obj / Debug / Corte.Library.pdb
修改:Tarifario.Site/bin /BLLTarifario.dll
修改:Tarifario.Site/bin/BLLTarifario.pdb
修改:Tarifario.Site/bin/Corte.Library.dll
修改:Tarifario.Site/bin/Corte。 Library.pdb
修改:Tarifario.Site/bin/Tarifario.Site.dll
修改:Tarifario.Site/bin/Tarifario.Site.pdb
修改:Tarifario.Site/obj/Debug /Tarifario.Site.csprojResolveAssemblyReference.cache
修改:Tarifario.Site/obj/Debug/Tarifario.Site.dll
修改:Tarifario.Site/obj/Debug/Tarifario.Site.pdb
修改:TestValidate / bin / Debug / BLLTarifario.dll
修改:TestValidate / bin / Debug / BLLTarifario.pdb
修改:TestValidate / bin / Debug / Corte.Library.dll
修改:TestValidate /bin/Debug/Corte.Library.pdb
修改:TestValidate / bin / Debug / TestValidate.exe
修改:TestValidate / bin / Debug / TestValidate.pdb
修改:TestValidate / obj / 86 /调试/ TestValidate.csprojResolveAssemblyReference.cac he
修改:TestValidate / obj / x86 / Debug / TestValidate.exe
修改:TestValidate / obj / x86 / Debug / TestValidate.pdb

这里是 .gitignore

  / build / 
* .suo
* .user
_ReSharper。* /
* .sdf
bin /
obj /
Debug /
Release /
* .opensdf
* .tlog
* .log
TestResult.xml
* .VisualState.xml
版本。 cs
Version.h
Version.cpp
* / bin / *
* / obj / *


解决方案

看起来您已将这些文件已经提交,然后将您的规则添加到 .gitignore 文件。 Git会继续监视已经被跟踪的文件。



您需要在删除这些文件时进行提交,然后应该忽略它们。 p>

编辑:要递归删除文件夹及其内容,请使用 git rm -r ,例如:

  git rm -r./BLLTarifario/bin/

您需要为每个 bin obj 要删除的目录。



或者,您可以删除文件夹(因为它们将在编译时重建)并运行 git add -A 再次展示已删除的更改。请参阅:暂存已删除的文件



由于我只需将它们从REPO中删除我对每个文件运行此命令

  git rm --cached BLLTarifario / bin / Debug /BLLTarifario.dll 

最后的 .gitignore 文件就是这个 p>

  *。cache 
* .dll
* .exe
* .pdb
/ build /
* .suo
* .user
_ReSharper。* /
* .sdf
* .opensdf
* .tlog
* .log
TestResult.xml
* .VisualState.xml
Version.cs
Version.h
Version.cpp


I have issues convicing GIT to ingore generated files

Here is an example of the files that I want to ignore

    modified:   BLLTarifario/bin/Debug/BLLTarifario.dll
    modified:   BLLTarifario/bin/Debug/BLLTarifario.pdb
    modified:   BLLTarifario/bin/Debug/Corte.Library.dll
    modified:   BLLTarifario/bin/Debug/Corte.Library.pdb
    modified:   BLLTarifario/obj/Debug/BLLTarifario.csprojResolveAssemblyReference.cache
    modified:   BLLTarifario/obj/Debug/BLLTarifario.dll
    modified:   BLLTarifario/obj/Debug/BLLTarifario.pdb
    modified:   Corte.Library/bin/Debug/Corte.Library.dll
    modified:   Corte.Library/bin/Debug/Corte.Library.pdb
    modified:   Corte.Library/obj/Debug/Corte.Library.csprojResolveAssemblyReference.cache
    modified:   Corte.Library/obj/Debug/Corte.Library.dll
    modified:   Corte.Library/obj/Debug/Corte.Library.pdb
    modified:   Tarifario.Site/bin/BLLTarifario.dll
    modified:   Tarifario.Site/bin/BLLTarifario.pdb
    modified:   Tarifario.Site/bin/Corte.Library.dll
    modified:   Tarifario.Site/bin/Corte.Library.pdb
    modified:   Tarifario.Site/bin/Tarifario.Site.dll
    modified:   Tarifario.Site/bin/Tarifario.Site.pdb
    modified:   Tarifario.Site/obj/Debug/Tarifario.Site.csprojResolveAssemblyReference.cache
    modified:   Tarifario.Site/obj/Debug/Tarifario.Site.dll
    modified:   Tarifario.Site/obj/Debug/Tarifario.Site.pdb
    modified:   TestValidate/bin/Debug/BLLTarifario.dll
    modified:   TestValidate/bin/Debug/BLLTarifario.pdb
    modified:   TestValidate/bin/Debug/Corte.Library.dll
    modified:   TestValidate/bin/Debug/Corte.Library.pdb
    modified:   TestValidate/bin/Debug/TestValidate.exe
    modified:   TestValidate/bin/Debug/TestValidate.pdb
    modified:   TestValidate/obj/x86/Debug/TestValidate.csprojResolveAssemblyReference.cache
    modified:   TestValidate/obj/x86/Debug/TestValidate.exe
    modified:   TestValidate/obj/x86/Debug/TestValidate.pdb

And here is the .gitignore

/build/
*.suo
*.user
_ReSharper.*/
*.sdf
bin/
obj/
Debug/
Release/
*.opensdf
*.tlog
*.log
TestResult.xml
*.VisualState.xml
Version.cs
Version.h
Version.cpp
*/bin/*
*/obj/*

解决方案

It looks like you had these files already committed before you added your rules to the .gitignore file. Git will continue to monitor files that are already being tracked.

You'll need to make a commit where you remove these files, then they should be ignored afterwards.

Edit: To remove a folder and it's contents recursively, use git rm -r, for example:

git rm -r "./BLLTarifario/bin/"

You'll need to do this for each of the bin and obj directories that you want to delete.

Optionally, you can delete the folders (since they'll be rebuilt at compile time) and run git add -A again to stage the deleted changes. See: Staging Deleted files

Since I only needed to remove them from the REPO I run this command for every single file

git rm --cached BLLTarifario/bin/Debug/BLLTarifario.dll

And the final .gitignore file is this

*.cache
*.dll
*.exe
*.pdb
/build/
*.suo
*.user
_ReSharper.*/
*.sdf
*.opensdf
*.tlog
*.log
TestResult.xml
*.VisualState.xml
Version.cs
Version.h
Version.cpp

这篇关于让GIT忽略DLL,PDB和类似的生成文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆