【干货分享】分享一份 .gitignore 文件

485 阅读1分钟

使用 git 作为版本控制的注意了,分享一份 .gitignore 文件,方便你设置 Git 忽略文件内容,更好管理项目。

废话不多说,直接上干活。

该通用版本的特性:

    1. 适用于 Java 项目,尤其是 IDEA 作为开发工具的项目
    1. 适用于 Windows 和 Mac 两个操作系统的协同操作
    1. 适用于 Maven 构建的项目,自动忽略 .mvnmvnw 文件

.gitignore 参考文件

### Java template[Begin] ###
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Java template[End] ###



### OSX template[Begin] ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### OSX template[End] ###



### Windows template[Begin] ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk
### Windows template[End] ###



### Eclipse template[Begin] ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/
### Eclipse template[End] ###


### IntelliJ project files[Begin] ###
.idea
*.iml
out
gen
### IntelliJ project files[End] ###

### project log files[Begin] ###
log
### project log files[End] ###



### this project[Begin] ###
target/
*.project
*.prefs
### this project[End] ###

### mvn ###
.mvn
mvnw
mvnw.cmd