A command-line tool to bootstrap .gitignore files from the GitHub gitignore patterns repository
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
contentstructs
errors
getters
list
writers
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTORS.md
LICENSE
Makefile
README.md
getignore.go
getignore_test.go
glide.lock
glide.yaml

README.md

getignore

getignore bootstraps .gitignore files from GitHub .gitignore patterns.

Travis CI Build Status

Installation

Homebrew users (macOS / OS X)

Homebrew users can install getignore using the following commands:

brew tap gotgenes/homebrew-gotgenes
brew update
brew install getignore

Chocolatey users (Windows)

Chocolatey users can install getignore using the following command (as admin):

choco install getignore

Windows, Linux, and macOS / OS X

Download and unpack a pre-compiled executable from the releases page. Make sure to place the executable in your shell's PATH.

Other platforms

See the Building section, below.

Usage

getignore supports the following commands:

help

You can get help on getignore itself with

getignore help

You can use help to get the full usage information of any other command. For example, to get the full usage of the get command, run

getignore help get

get

Use the get command to obtain gitignore patterns from remote repositories. By default, it will obtain patterns from the GitHub gitignore repository, and write these patterns to the STDOUT. Simply pass in the names of the ignore files you wish to retrieve.

For example,

getignore get Go.gitignore Global/Vim.gitignore

downloads and concatenates the Go and Vim ignore patterns and writes them to STDOUT.

Note the .gitignore extension on the names optional. Feel free to omit the extension; the previous example could be issued more simply as

getignore get Go Global/Vim

so long as they share a common extension. (See also the --default-extension option.)

If you'd like to write the contents directly to a file, use the -o option. For example,

getignore get -o .gitignore Go Global/Vim

Would write the contents of the Go and Vim ignore patterns into the .gitignore file in the current working directory (./.gitignore).

When retrieving many ignore patterns, it can be helpful instead to list names in a file, instead. Given the following file, names.txt

Go
Node
Yeoman
Global/Eclipse
Global/Emacs
Global/JetBrains
Global/Linux
Global/NotepadPP
Global/SublimeText
Global/Tags
Global/TextMate
Global/Vim
Global/Windows
Global/Xcode
Global/macOS

we can get all the patterns in this file by passing it via the --names-file option

getignore get --names-file names.txt

Please see the get usage via getignore help get for explanations of other options available.

list

Use this command to get a listing of available gitignore patterns files from a remote repository and print the listing to STDOUT. This allows users to standard *nix tools to manipulate the command's output. For example, the following command line command can be used to download all the "global" gitignore patterns files:

getignore list | grep Global/ | xargs getignore get

By default, list queries the GitHub .gitignore patterns repository using the GitHub API v3 Trees endpoint. It is possible to pass in a different API URL via the --api-url flag, however.

By default, it filters for files that end with the .gitignore suffix, however, you can provide an alternative suffix via the --suffix flag. To list all files, provide an empty suffix, e.g.

getignore list --suffix ''

Building

getignore's dependencies are managed by the Glide package manager. First install Glide, then build getignore.

curl https://glide.sh/get | sh
glide install
go build