如何生成 gitignore 文件?

先来看看它支持什么语言环境、IDE集成环境。

安装之后使用 gi list 查看支持的情况

# gi list
actionscript,ada,agda,android,anjuta,appceleratortitanium,appcode,appengine,archives,archlinuxpackages,autotools,basercms,bluej,bower,bricxcc,c,c++,cakephp,carthage,cfwheels,chefcookbook,clojure,cloud9,cmake,codeigniter,codeio,codekit,commonlisp,composer,concrete5,coq,craftcms,crashlytics,cuda,cvs,dart,darteditor,delphi,django,dm,dotsettings,dreamweaver,drupal,eagle,eclipse,eiffelstudio,elasticbeanstalk,elisp,elixir,emacs,ensime,episerver,erlang,espresso,expressionengine,extjs,fancy,finale,flexbuilder,forcedotcom,fortran,freepascal,fuelphp,gcov,gitbook,go,gradle,grails,greenfoot,grunt,gwt,haskell,idris,igorpro,intellij,ipythonnotebook,jabref,java,jboss,jdeveloper,jekyll,jetbrains,joe,joomla,jspm,justcode,jython,kate,kdevelop4,kirby2,kohana,komodoedit,labview,laravel,latex,lazarus,leiningen,lemonstand,liberosoc,librarian-chef,libreoffice,lilypond,linux,lithium,lua,lyx,m2e,magento,matlab,maven,mercurial,mercury,metaprogrammingsystem,meteor,microsoftoffice,modelsim,momentics,monodevelop,nanoc,netbeans,nette,nim,ninja,node,notepadpp,objective-c,ocaml,opa,opencart,openfoam,oracleforms,osx,packer,perl,ph7cms,phalcon,phpstorm,pinegrow,playframework,plone,premake-gmake,prestashop,processing,puppet-librarian,pycharm,python,qooxdoo,qt,r,rails,redcar,redis,rhodesrhomobile,ros,ruby,rubymine,rust,sass,sbt,scala,scons,scrivener,sdcc,seamgen,senchatouch,silverstripe,sketchup,slickedit,stella,stellar,sublimetext,sugarcrm,svn,swift,symfony,symphonycms,synopsysvcs,tags,tarmainstallmate,tex,textmate,textpattern,tortoisegit,tower,turbogears2,typo3,umbraco,unity,vagrant,vim,virtualenv,visualstudio,vvvv,waf,wakanda,webmethods,webstorm,windows,wintersmith,wordpress,xamarinstudio,xcode,xilinxise,xojo,yeoman,yii,zendframework,zephir

基本上常见的语言和 IDE 环境都支持了。

去它的官网看一下如何安装吧。

https://www.gitignore.io/

有点像一个搜索引擎,哈哈,它就是一个搜索引擎,你可搜索你的语言名称或是 IDE 名称,然后它就可以给你生成一个相应的 gitignore 文件内容了。

怎么安装呢,查看一下它的文档。

安装说明

所谓安装,就是在 shell 环境中,添加了一个名为 gi 的 function 脚本片断。通过 curl 获取指定的信息,并展示出来。

生成工作需要用的 gitignore 文件,通过下面的命令

# gi node
# Created by https://www.gitignore.io

### Node ###
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

然并卵,光是打印出来有吊用?

# gi node > .gitignore

基本上到这里就OK了。