zoukankan      html  css  js  c++  java
  • GitHub实战系列~3.提交github的时候过滤某些文件 2015-12-10

    GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html

    ——————————————————————————————————————————————————————

    很多人问,明明有git gui 和 github可以直接图形化操作的吗?全部指令干啥???

    呃(⊙o⊙)…呃(⊙o⊙)… ===> 装逼~

    O(∩_∩)O~,开玩笑的,其实就是为了通用和熟悉git,linux里面照样这样用,多熟悉点基础指令很有用的,

    如果觉得顿时不开心了、无爱了==>推荐你快速入门:http://www.imooc.com/learn/390

    ———————————————————————————————————————————————————————

    创建项目的时候在最下面,添加过滤器,选择vs 或者把 .gitignore 拷贝一份放git项目文件夹的根目录

    建完就有两个文件了,.gitignore 是过滤文件

    补充:在windows里面直接建立这个文件是不行的,windows最后一个.前面必须有名字(linux里面有.号开头的文件),除了拷贝再介绍一个方法:

    进github,单击 New File 然后把最下面的过滤文件加进去(ssh的左边第一个按钮)

    vs的过滤规则贴一下:

      1 ## Ignore Visual Studio temporary files, build results, and
      2 ## files generated by popular Visual Studio add-ons.
      3 
      4 # User-specific files
      5 *.suo
      6 *.user
      7 *.userosscache
      8 *.sln.docstates
      9 
     10 # User-specific files (MonoDevelop/Xamarin Studio)
     11 *.userprefs
     12 
     13 # Build results
     14 [Dd]ebug/
     15 [Dd]ebugPublic/
     16 [Rr]elease/
     17 [Rr]eleases/
     18 x64/
     19 x86/
     20 build/
     21 bld/
     22 [Bb]in/
     23 [Oo]bj/
     24 
     25 # Visual Studo 2015 cache/options directory
     26 .vs/
     27 
     28 # MSTest test Results
     29 [Tt]est[Rr]esult*/
     30 [Bb]uild[Ll]og.*
     31 
     32 # NUNIT
     33 *.VisualState.xml
     34 TestResult.xml
     35 
     36 # Build Results of an ATL Project
     37 [Dd]ebugPS/
     38 [Rr]eleasePS/
     39 dlldata.c
     40 
     41 *_i.c
     42 *_p.c
     43 *_i.h
     44 *.ilk
     45 *.meta
     46 *.obj
     47 *.pch
     48 *.pdb
     49 *.pgc
     50 *.pgd
     51 *.rsp
     52 *.sbr
     53 *.tlb
     54 *.tli
     55 *.tlh
     56 *.tmp
     57 *.tmp_proj
     58 *.log
     59 *.vspscc
     60 *.vssscc
     61 .builds
     62 *.pidb
     63 *.svclog
     64 *.scc
     65 
     66 # Chutzpah Test files
     67 _Chutzpah*
     68 
     69 # Visual C++ cache files
     70 ipch/
     71 *.aps
     72 *.ncb
     73 *.opensdf
     74 *.sdf
     75 *.cachefile
     76 
     77 # Visual Studio profiler
     78 *.psess
     79 *.vsp
     80 *.vspx
     81 
     82 # TFS 2012 Local Workspace
     83 $tf/
     84 
     85 # Guidance Automation Toolkit
     86 *.gpState
     87 
     88 # ReSharper is a .NET coding add-in
     89 _ReSharper*/
     90 *.[Rr]e[Ss]harper
     91 *.DotSettings.user
     92 
     93 # JustCode is a .NET coding addin-in
     94 .JustCode
     95 
     96 # TeamCity is a build add-in
     97 _TeamCity*
     98 
     99 # DotCover is a Code Coverage Tool
    100 *.dotCover
    101 
    102 # NCrunch
    103 _NCrunch_*
    104 .*crunch*.local.xml
    105 
    106 # MightyMoose
    107 *.mm.*
    108 AutoTest.Net/
    109 
    110 # Web workbench (sass)
    111 .sass-cache/
    112 
    113 # Installshield output folder
    114 [Ee]xpress/
    115 
    116 # DocProject is a documentation generator add-in
    117 DocProject/buildhelp/
    118 DocProject/Help/*.HxT
    119 DocProject/Help/*.HxC
    120 DocProject/Help/*.hhc
    121 DocProject/Help/*.hhk
    122 DocProject/Help/*.hhp
    123 DocProject/Help/Html2
    124 DocProject/Help/html
    125 
    126 # Click-Once directory
    127 publish/
    128 
    129 # Publish Web Output
    130 *.[Pp]ublish.xml
    131 *.azurePubxml
    132 # TODO: Comment the next line if you want to checkin your web deploy settings 
    133 # but database connection strings (with potential passwords) will be unencrypted
    134 *.pubxml
    135 *.publishproj
    136 
    137 # NuGet Packages
    138 *.nupkg
    139 # The packages folder can be ignored because of Package Restore
    140 **/packages/*
    141 # except build/, which is used as an MSBuild target.
    142 !**/packages/build/
    143 # Uncomment if necessary however generally it will be regenerated when needed
    144 #!**/packages/repositories.config
    145 
    146 # Windows Azure Build Output
    147 csx/
    148 *.build.csdef
    149 
    150 # Windows Store app package directory
    151 AppPackages/
    152 
    153 # Others
    154 *.[Cc]ache
    155 ClientBin/
    156 [Ss]tyle[Cc]op.*
    157 ~$*
    158 *~
    159 *.dbmdl
    160 *.dbproj.schemaview
    161 *.pfx
    162 *.publishsettings
    163 node_modules/
    164 bower_components/
    165 
    166 # RIA/Silverlight projects
    167 Generated_Code/
    168 
    169 # Backup & report files from converting an old project file
    170 # to a newer Visual Studio version. Backup files are not needed,
    171 # because we have git ;-)
    172 _UpgradeReport_Files/
    173 Backup*/
    174 UpgradeLog*.XML
    175 UpgradeLog*.htm
    176 
    177 # SQL Server files
    178 *.mdf
    179 *.ldf
    180 
    181 # Business Intelligence projects
    182 *.rdl.data
    183 *.bim.layout
    184 *.bim_*.settings
    185 
    186 # Microsoft Fakes
    187 FakesAssemblies/
    188 
    189 # Node.js Tools for Visual Studio
    190 .ntvs_analysis.dat
    191 
    192 # Visual Studio 6 build log
    193 *.plg
    194 
    195 # Visual Studio 6 workspace options file
    196 *.opt
    View Code

     扩展:(可以自己添加过滤文件/规则)

    忽略文件

    一般我们总会有些文件无需纳入 Git 的管理,也不希望它们总出现在未跟踪文件列表。 通常都是些自动生成的文件,比如日志文件,或者编译过程中创建的临时文件等。 在这种情况下,我们可以创建一个名为 .gitignore 的文件,列出要忽略的文件模式。 来看一个实际的例子:

    $ cat .gitignore
    *.[oa]
    *~

    第一行告诉 Git 忽略所有以 .o 或 .a 结尾的文件。一般这类对象文件和存档文件都是编译过程中出现的。 第二行告诉 Git 忽略所有以波浪符(~)结尾的文件,许多文本编辑软件(比如 Emacs)都用这样的文件名保存副本。 此外,你可能还需要忽略 log,tmp 或者 pid 目录,以及自动生成的文档等等。 要养成一开始就设置好 .gitignore 文件的习惯,以免将来误提交这类无用的文件。

    文件 .gitignore 的格式规范如下:

    • 所有空行或者以  开头的行都会被 Git 忽略。

    • 可以使用标准的 glob 模式匹配。

    • 匹配模式可以以(/)开头防止递归。

    • 匹配模式可以以(/)结尾指定目录。

    • 要忽略指定模式以外的文件或目录,可以在模式前加上惊叹号(!)取反。

    所谓的 glob 模式是指 shell 所使用的简化了的正则表达式。 星号(*)匹配零个或多个任意字符;[abc]匹配任何一个列在方括号中的字符(这个例子要么匹配一个 a,要么匹配一个 b,要么匹配一个 c);问号(?)只匹配一个任意字符;如果在方括号中使用短划线分隔两个字符,表示所有在这两个字符范围内的都可以匹配(比如 [0-9] 表示匹配所有 0 到 9 的数字)。 使用两个星号(*) 表示匹配任意中间目录,比如`a/**/z` 可以匹配 a/za/b/z 或 `a/b/c/z`等。

  • 相关阅读:
    django 项目需要注意的一些点
    VUE之路
    Oracle 表格碎片的查看方法
    RHEL 6.x or 7.x 使用分区绑定ASM 磁盘的方法
    RMAN 修复主库 nologging 操作导致物理备库的坏块
    Oracle 数据库19c 回退降级到 11.2.0.4 方案
    如何评估oracle 数据库rman全备和增量备份大小
    在将Oracle GI和DB升级到19c或降级到以前的版本之前需要应用的补丁 (Doc ID 2668071.1)
    Oracle 数据库坏块处理
    opatch auto 安装11.2.0.4.20190115 PSU遇到 OUI-67133: Execution of PRE script failed,with returen value 1 报错
  • 原文地址:https://www.cnblogs.com/dunitian/p/5036028.html
Copyright © 2011-2022 走看看