2016-04-02 18 views

回答

5

我的團隊通常在不同的操作系統(Win/Lin)以及各種協作工具和編輯器上工作。所以我爲我的團隊開發了一個使用IntelliJ的標準.gitignore,可以在許多系統和編輯器上正常工作。這裏是:

# Created by .ignore support plugin (hsz.mobi) 
### Grails template 
# .gitignore for Grails 1.2 and 1.3 
# Although this should work for most versions of grails, it is 
# suggested that you use the "grails integrate-with --git" command 
# to generate your .gitignore file. 

# web application files 
/web-app/WEB-INF/classes 

# default HSQL database files 
/prodDb.* 
/devDb.* 

# general HSQL database files 
*Db.properties 
*Db.script 

# logs 
/stacktrace.log 
/test/reports 
/logs 

# project release file 
/*.war 

# plugin release files 
/*.zip 
/plugin.xml 

# older plugin install locations 
/plugins 
/web-app/plugins 

# "temporary" build files 
/target 
### Java template 
*.class 
*.asscache 
# 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* 
### NetBeans template 
nbproject/private/ 
build/ 
nbbuild/ 
dist/ 
nbdist/ 
nbactions.xml 
nb-configuration.xml 
.nb-gradle/ 
### JetBrains template 
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 

*.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 

# 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 
### Eclipse template 
*.pydevproject 
.metadata 
.gradle 
bin/ 
tmp/ 
*.tmp 
*.bak 
*.swp 
*~.nib 
local.properties 
.settings/ 
.loadpath 

# Eclipse Core 
.project 

# External tool builders 
.externalToolBuilders/ 

# Locally stored "Eclipse launch configurations" 
*.launch 


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

# Java annotation processor (APT) 
.factorypath 


# Ignore Gradle GUI config 
gradle-app.setting 

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 
!gradle-wrapper.jar 
### SublimeText template 
# cache files for sublime text 
*.tmlanguage.cache 
*.tmPreferences.cache 
*.stTheme.cache 

# workspace files are user-specific 
*.sublime-workspace 

# project files should be checked into the repository, unless a significant 
# proportion of contributors will probably not be using SublimeText 
# *.sublime-project 

# sftp configuration file 
sftp-config.json 
### Linux template 
*~ 

# KDE directory preferences 
.directory 

# Linux trash folder which might appear on any partition or disk 
.Trash-* 
### Vim template 
[._]*.s[a-w][a-z] 
[._]s[a-w][a-z] 
*.un~ 
Session.vim 
.netrwhist 
+0

的必須有grails3配置以及任何gradle這個項目不會忽略gradle-wrapper.jar。在我的文件的評論中看到類似的描述。 –

0

的Grails 3.x的是建立與gradle這個,很多用於較早版本的Grails忽略的條目是沒有必要了。看看gradle的.gitignore文件,它只忽略'.gradle'目錄和'build'目錄。它也確保不會忽略包裝jar文件。

0

那麼這完全是你的技術雙手的選擇問題,如想法或日食等許多其他組合。

因此,您的.gitignore文件將取決於您實際上不希望存儲到回購的內容。

以下是幾個這樣的事情:

  1. 是那些獲得的編譯後生成例如任何事插件,類文件和構建工具特定的數據等
  2. 任何不屬於您的應用程序的部分,只有本地機器和工具才需要用於開發和測試目的,例如.iml文件或想法特定文件。 請記住,當我說不是應用程序的一部分意味着最低限度的東西可以成功運行,而不必考慮它可能需要從遠程服務器下載某些東西。

可能是這個答案你!

5

所有以前的帖子給出了合理的建議。下面是從一個Grails 3項目.gitignore文件一個很好的起點(注意第4行,我不包括這裏的IntelliJ項目文件,這可能/可能不會成爲你的關注):

*.iml 
*.ipr 
*.iws 
.idea 

.gradle 
.asscache 
build 
out 
logs 
classes 
+0

看一看這個https://www.gitignore.io/api/grails我不知道,如果他們尊重的Grails 3.0 – ppasler