Git使用技巧-文件忽略
一、.Net的.gitignore文件
1 # Visual Studio 2 3 # User-specific files 4 *.suo 5 *.user 6 *.userosscache 7 *.sln.docstates 8 9 # User-specific files (MonoDevelop/Xamarin Studio) 10 *.userprefs 11 12 # Build results 13 [Dd]ebug/ 14 [Dd]ebugPublic/ 15 [Rr]elease/ 16 [Rr]eleases/ 17 [Xx]64/ 18 [Xx]86/ 19 [Bb]uild/ 20 bld/ 21 [Bb]in/ 22 [Oo]bj/ 23 24 # Visual Studio 2015 cache/options directory 25 .vs/ 26 # Uncomment if you have tasks that create the project's static files in wwwroot 27 #wwwroot/ 28 29 # MSTest test Results 30 [Tt]est[Rr]esult*/ 31 [Bb]uild[Ll]og.* 32 33 # NUNIT 34 *.VisualState.xml 35 TestResult.xml 36 37 # Build Results of an ATL Project 38 [Dd]ebugPS/ 39 [Rr]eleasePS/ 40 dlldata.c 41 42 # DNX 43 project.lock.json 44 artifacts/ 45 46 *_i.c 47 *_p.c 48 *_i.h 49 *.ilk 50 *.meta 51 *.obj 52 *.pch 53 *.pdb 54 *.pgc 55 *.pgd 56 *.rsp 57 *.sbr 58 *.tlb 59 *.tli 60 *.tlh 61 *.tmp 62 *.tmp_proj 63 *.log 64 *.vspscc 65 *.vssscc 66 .builds 67 *.pidb 68 *.svclog 69 *.scc 70 71 # Chutzpah Test files 72 _Chutzpah* 73 74 # Visual C++ cache files 75 ipch/ 76 *.aps 77 *.ncb 78 *.opendb 79 *.opensdf 80 *.sdf 81 *.cachefile 82 *.VC.db 83 *.VC.VC.opendb 84 85 # Visual Studio profiler 86 *.psess 87 *.vsp 88 *.vspx 89 *.sap 90 91 # TFS 2012 Local Workspace 92 $tf/ 93 94 # Guidance Automation Toolkit 95 *.gpState 96 97 # ReSharper is a .NET coding add-in 98 _ReSharper*/ 99 *.[Rr]e[Ss]harper 100 *.DotSettings.user 101 102 # JustCode is a .NET coding add-in 103 .JustCode 104 105 # TeamCity is a build add-in 106 _TeamCity* 107 108 # DotCover is a Code Coverage Tool 109 *.dotCover 110 111 # NCrunch 112 _NCrunch_* 113 .*crunch*.local.xml 114 nCrunchTemp_* 115 116 # MightyMoose 117 *.mm.* 118 AutoTest.Net/ 119 120 # Web workbench (sass) 121 .sass-cache/ 122 123 # Installshield output folder 124 [Ee]xpress/ 125 126 # DocProject is a documentation generator add-in 127 DocProject/buildhelp/ 128 DocProject/Help/*.HxT 129 DocProject/Help/*.HxC 130 DocProject/Help/*.hhc 131 DocProject/Help/*.hhk 132 DocProject/Help/*.hhp 133 DocProject/Help/Html2 134 DocProject/Help/html 135 136 # Click-Once directory 137 publish/ 138 139 # Publish Web Output 140 *.[Pp]ublish.xml 141 *.azurePubxml 142 *.publishproj 143 *.pubxml 144 PublishProfiles/ 145 PublishScripts/ 146 147 # NuGet Packages 148 *.nupkg 149 # The packages folder can be ignored because of Package Restore 150 **/packages/* 151 # except build/, which is used as an MSBuild target. 152 !**/packages/build/ 153 # Uncomment if necessary however generally it will be regenerated when needed 154 #!**/packages/repositories.config 155 # NuGet v3's project.json files produces more ignoreable files 156 *.nuget.props 157 *.nuget.targets 158 159 # Microsoft Azure Build Output 160 csx/ 161 *.build.csdef 162 163 # Microsoft Azure Emulator 164 ecf/ 165 rcf/ 166 167 # Windows Store app package directory 168 AppPackages/ 169 BundleArtifacts/ 170 Package.StoreAssociation.xml 171 _pkginfo.txt 172 173 # Visual Studio cache files 174 # files ending in .cache can be ignored 175 *.[Cc]ache 176 # but keep track of directories ending in .cache 177 !*.[Cc]ache/ 178 179 # Others 180 ClientBin/ 181 [Ss]tyle[Cc]op.* 182 ~$* 183 *~ 184 *.dbmdl 185 *.dbproj.schemaview 186 *.pfx 187 *.publishsettings 188 orleans.codegen.cs 189 190 # RIA/Silverlight projects 191 Generated_Code/ 192 193 # Backup & report files from converting an old project file 194 # to a newer Visual Studio version. Backup files are not needed, 195 # because we have git ;-) 196 _UpgradeReport_Files/ 197 Backup*/ 198 UpgradeLog*.XML 199 UpgradeLog*.htm 200 201 # SQL Server files 202 *.mdf 203 *.ldf 204 205 # Business Intelligence projects 206 *.rdl.data 207 *.bim.layout 208 *.bim_*.settings 209 210 # Microsoft Fakes 211 FakesAssemblies/ 212 213 # GhostDoc plugin setting file 214 *.GhostDoc.xml 215 216 # Node.js Tools for Visual Studio 217 .ntvs_analysis.dat 218 219 # Visual Studio 6 build log 220 *.plg 221 222 # Visual Studio 6 workspace options file 223 *.opt 224 225 # Visual Studio LightSwitch build output 226 **/*.HTMLClient/GeneratedArtifacts 227 **/*.DesktopClient/GeneratedArtifacts 228 **/*.DesktopClient/ModelManifest.xml 229 **/*.Server/GeneratedArtifacts 230 **/*.Server/ModelManifest.xml 231 _Pvt_Extensions 232 233 # LightSwitch generated files 234 GeneratedArtifacts/ 235 ModelManifest.xml 236 237 # Paket dependency manager 238 .paket/paket.exe 239 paket-files/ 240 241 # FAKE - F# Make 242 .fake/ 243 244 .DS_Store
二、忽略已经提交的文件
1 git rm -r --cached . 2 git add . 3 git commit -m 'update .gitignore'