在Git中使用Visual Studio时要忽略的文件 [英] Files to ignore when using Visual Studio with Git

查看:861
本文介绍了在Git中使用Visual Studio时要忽略的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装Git来使用Visual Studio 2008进行一些开发。大部分工作都是新开发,但我们确实有一些来自VS2005之前的旧项目,我希望将它们引入到新的存储库中。有关于一般 VS / Git集成的现有线索,但我的问题仅限于.gitignore文件和Visual Studio。

我的问题有两部分:


  • .gitignore文件中应该包含哪些条目来覆盖像二进制文件,程序集,调试文件等Visual Studio特定文件?有些被上面提到的线程所覆盖,但是有一个全面的集合吗?

  • 在什么情况下你需要全局排除文件,或者单个存储库,或者使用环境变量?

  • 我已经知道了HOW。以下是Git的摘录用户手册 on忽略文件。


    如果您希望排除模式为
    ,只会影响某些存储库
    (而不是每个给定
    给定项目的存储库),您可以将
    放入存储库
    中的一个文件中,该文件名为.git / info / exclude,或者由
    文件指定的任何
    文件
    core.excludesfile配置
    变量。一些git命令也可以
    直接在
    命令行上排除模式。有关
    的详细信息,请参阅 gitignore(5)



    解决方案

    在GitExtensions中,默认的.gitignore就是这样。它可以通过删除大多数单个文件扩展名来缩短,并且只排除它们所在的目录。

      *。obj 
    * .exe
    * .exp
    * .pdb
    * .dll
    * .user
    * .aps
    * .pch
    * .vspscc
    * _i.c
    * _p.c
    * .ncb
    * .suo
    * .tlb
    * .tlh
    * .bak
    * .cache
    * .ilk
    * .log
    * .zip
    [Dd] ebug * /
    * .lib
    * .sbr
    Thumbs.db
    [Ll] ib /
    [Rr] elease * /
    [Tt] est [Rr] esults /
    _UpgradeReport_Files /
    _ReSharper。* /


    I've installed Git to do some development using Visual Studio 2008. Most of the work will be new development but we do have some old projects from prior to VS2005 that I want to bring over into the new repository. There is an existing thread about general VS/Git integration but my question is limited to the .gitignore file and Visual Studio.

    My question has two parts:

    • What entries should be included in the .gitignore file to cover the Visual Studio specific files like binaries, assemblies, debug files, etc? Some were covered in the thread mentioned above but is there a comprehensive set?

    • In what situations have you needed to exclude files globally, or for a single repository, or using the environment variable?

    I already know the HOW. Here is an excerpt from the Git user-manual on ignoring files.

    If you wish the exclude patterns to affect only certain repositories (instead of every repository for a given project), you may instead put them in a file in your repository named .git/info/exclude, or in any file specified by the core.excludesfile configuration variable. Some git commands can also take exclude patterns directly on the command line. See gitignore(5) for the details.

    解决方案

    In GitExtensions the default .gitignore is this. It can be a bit shorted by removing most individual file extensions and only exclude the directories they are in.

    *.obj
    *.exe
    *.exp
    *.pdb
    *.dll
    *.user
    *.aps
    *.pch
    *.vspscc
    *_i.c
    *_p.c
    *.ncb
    *.suo
    *.tlb
    *.tlh
    *.bak
    *.cache
    *.ilk
    *.log
    *.zip
    [Dd]ebug*/
    *.lib
    *.sbr
    Thumbs.db
    [Ll]ib/
    [Rr]elease*/
    [Tt]est[Rr]esults/
    _UpgradeReport_Files/
    _ReSharper.*/
    

    这篇关于在Git中使用Visual Studio时要忽略的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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