Generator .gitignore file

Mariusz Wyszomierski Tools Generator .gitignore file

Tools

Generator .gitignore file

Posted By Mariusz Wyszomierski

What is .gitignore file?

It’s a file containing names or pattern names of directories and files, that should’t be included in GIT repository.
These are among others files generated by IDE – in case of IntelliJ IDEA it’s a directory .idea and file with extension *.iml.

Generator .gitignore

On website https://www.gitignore.io/ you can generate content of .gitignore file for tools, IDE’s and frameworks you are using in project.
For example for projects, which using maven and developers are using Intellij IDEA it generates file like below.
Sometimes you should uncomment (delete # from the begining of line) some rules according to your project.
gitignore-example

# Created by https://www.gitignore.io/api/maven,intellij

### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# .idea/shelf

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

Generating .gitignore files from command line

It is possible to generate .gitignore file from command line. For linux you can add handling of new command gi.
Just run below command:

echo "function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;}" >> ~/.bashrc && source ~/.bashrc

Next you can create .gitignore file running:

gi maven,intelij >> .gitignore

Written by Mariusz Wyszomierski

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.