项目作者: whoshuu

项目描述 :
Declarative .gitignore
高级语言: Go
项目地址: git://github.com/whoshuu/ignoreit.git
创建时间: 2017-02-25T22:19:38Z
项目社区:https://github.com/whoshuu/ignoreit

开源协议:MIT License

下载


Declarative .gitignore" class="reference-link">ignoreit Declarative .gitignore

Build Status Go Report Card codecov

ignoreit is a utility to produce declarative .gitignore specifications that can be used to generate actual .gitignore files. In fact, this .gitignore was produced like this:

  1. ignoreit add Go
  2. ignoreit generate

The first command produces a schema .ignoreit.yml that abstracts the details of a set of .gitignore patterns into a human readable specification. It takes this form:

  1. sources:
  2. - repo: github/gitignore
  3. branch: master
  4. entries:
  5. - Go
  6. - repo: whoshuu/gitignore
  7. branch: develop
  8. entries:
  9. - C++
  10. - Python
  11. custom:
  12. - .custompattern
  13. - .anothercustompattern
  14. schema_version: 1

The second command takes this specification and generates a corresponding .gitignore file from it.

Both files should be checked into source control. Only the first should be manually edited via ignoreit, and the second is simply an artifact of changing the schema.

Install

You can install the ignoreit binary like how you would install any Go program:

  1. go get github.com/whoshuu/ignoreit

Since the dependencies are vendored, this should pull in a single package and binary in your ${GOPATH}/bin called ignoreit.

Commands

In addition to ignoreit add and ignoreit generate, there is ignoreit remove. This will remove the patterns specified in the argument.

Both add and remove take an arbitrary number of arguments, so multiple entries can be specified at once:

  1. ignoreit add Go CMake C++ Python
  2. ignoreit remove CMake C++

These commands take --repo and --branch flags for specifying the source repository and branch to use for pulling down .gitignore entries. By default these are github/gitignore and master respectively.

Finally, ignoreit generate should be run any time changes are made to .ignoreit.yml. This command takes no arguments and simply inflates the specification into an appropriate .gitignore.