rnv812 / gitignore

Bash script for creating .gitignore file for specific language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gitignore

Bash script for creating .gitignore file for specific language

Installation

chmod +x install.sh
./install.sh 

Usage

gitignore <template name> # Autocomplete is provided

Example

The next command will generate .gitignore file for python within current working directory:

gitignore Python

Templates

All templates are coppied to ~/.gitignore_templates/ after the installation. You can place new template files or modify existing right there.

FAQ

Why installation script asks me for sudo password?

To use autocomplete it needs to place completion script to /etc/bash_completion.d/ which is owned by root.

After installation command gitignore is not found.

Try to add ~/.local/bin/ directory to $PATH. You can use next command:

echo "export PATH=$PATH:/home/${USER}/.local/bin/" >> "~/.bashrc"

Is it possible to use script if I'm Windows user?

You can run it using:

  • WSL, with no any differences;
  • Git Bash, not using installation script but not having autocomplete and manually adjusting path to templates by changing next line:
# gitignore.sh
TEMPLATE="/home/${USER}/.gitignore_templates/$1.gitignore"

Should be changed to something like following:

TEMPLATE=~/"Documents/.gitignore_templates/$1.gitignore"

The above example assumes that templates are placed into C:\Users\<user>\Documents\.gitignore_templates folder.

References

All gitignore templates were taken from the official repo: https://github.com/github/gitignore

About

Bash script for creating .gitignore file for specific language

License:MIT License


Languages

Language:Shell 100.0%