Giter VIP home page Giter VIP logo

git-ignore's Introduction

Git-ignore

Gitignore Template Generator. | 日本語記事
Git-ignore helps you to generate .gitignore file based on templates.
You can install it with ease, and customize with your own templates.

Try it now, and leave me a start if you like it. ☆ ヽ(^ω^ #)

Install

$ pip install git-ignore

Usage

Example: Django project that uses Python and Sass.

$ git-ignore python sass

This will create a .gitignore file that comes from both Python and Sass gitignore templates.

Note that you can add multiple templates at once. Also, it is not case sensitive.

Example: When you want to just add a few lines.

$ git-ignore --add !.keep !.gitkeep

This will add two lines on the bottom of your .gitignore file.

Example: Use custom templates.

$ mkdir ~/.gitignore_templates
$ echo '.DS_Store' > ~/.gitignore_templates/macOS.gitignore
$ git-ignore macOS

Running this, the command will look up at ~/.gitignore_templates/, and try to use ~/.gitignore_templates/macOS.gitignore.

And more...

Find the full list of options by running

$ git-ignore --help

How it works

This tool uses templates from GitHub's .gitignore Templates Collection.

Thus it supports:

Perl6, Sass, Scala, Joomla, CakePHP, Go, Yeoman, ZendFramework, KiCad, Textpattern, ExpressionEngine, Typo3, Packer, Elisp, EPiServer, Gcov, Haskell, GWT, LabVIEW, C++, Objective-C, Composer, SketchUp, Eagle, Android, Symfony, ExtJs, Erlang, Finale, Sdcc, Scrivener, Qooxdoo, RhodesRhomobile, PlayFramework, Stella, SugarCRM, Delphi, TurboGears2, Waf, Leiningen, Dart, R, ChefCookbook, MetaProgrammingSystem, CFWheels, Lilypond, Processing, Kohana, Clojure, GitBook, Lithium, Magento, Node, Python, Nim, Terraform, Yii, Nanoc, Umbraco, DM, Java, Elixir, WordPress, Godot, Xojo, ArchLinuxPackages, Jekyll, Ada, D, Elm, Actionscript, Swift, Grails, Laravel, Perl, CMake, VVVV, VisualStudio, CraftCMS, Coq, Rust, Scheme, IGORPro, Drupal, Plone, AppEngine, Mercury, Jboss, Lua, PureScript, CUDA, AppceleratorTitanium, Concrete5, CodeIgniter, Fortran, Julia, ForceDotCom, OracleForms, Smalltalk, Rails, Phalcon, Prestashop, Agda, Unity, FuelPHP, LemonStand, SeamGen, SCons, SymphonyCMS, CommonLisp, Gradle, Maven, Ruby, OpenCart, Fancy, TeX, Zephir, OCaml, UnrealEngine, Autotools, C, Kotlin, Qt, ROS, Idris, Opa

Features

  • ✔︎ Add .gitignore from templates.
  • ✔︎ Can add multiple templates at once.
  • ✔︎ Based on GitHub's templates collection.
  • ✔︎ Support "Global (operating system or editor specific) templates".
  • ✔︎ Helpful --help option.
  • ✔︎ User defined template.

Contributing

Issues and PRs are welcome :)

License

MIT

git-ignore's People

Contributors

qqpann avatar

Stargazers

 avatar

Watchers

 avatar  avatar

git-ignore's Issues

Completion

Template name completion.

Example:

$ git-ignore <tab><tab>
Available templates:
    ... Python, ..., Go, ...

test_stdout_add__contains_no_garbage failure

On Python 3.7 with click 7.x, I encounter

[   31s] ______________ TemplateTests.test_stdout_add__contains_no_garbage ______________
[   31s] 
[   31s] self = <tests.test_main.TemplateTests testMethod=test_stdout_add__contains_no_garbage>
[   31s] 
[   31s]     def test_stdout_add__contains_no_garbage(self):
[   31s]         some_name = 'some_name_that_dont_exist'
[   31s]         with EvacuateCustomTemplatesDir(), \
[   31s]                 self.runner.isolated_filesystem():
[   31s]             # Define custom template
[   31s]             CUSTOM_DIR = os.path.expanduser('~/.gitignore_templates/')
[   31s]             os.makedirs(CUSTOM_DIR)
[   31s]             with open(CUSTOM_DIR + some_name + '.gitignore', 'w') as f:
[   31s]                 f.write('foobar')
[   31s]     
[   31s]             result = self.runner.invoke(cli, ['--stdout', '-a', 'foobar'])
[   31s]             stdout_str = result.output
[   31s]     
[   31s] >           self.assertEqual(stdout_str, 'foobar\n')
[   31s] E           AssertionError: '\nfoobar\n\n' != 'foobar\n'
[   31s] E           - 
[   31s] E             foobar
[   31s] E           -

Detect duplicate lines, and function well when adding git-ignore twice

Summary

Currently, if you add ignore to an identical template multiple times (ex. git-ignore python twice), your .gitignore will just include these ignore lines twice.

To improve this, detect duplicates and delete duplicates. Then, gather the remaining to the bottom of .gitignore file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.