php Laravel 和 PHPStorm 项目的 gitignore 中要包含什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25748132/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:59:03  来源:igfitidea点击:

What to include in gitignore for a Laravel and PHPStorm project?

phpgitlaravelphpstorm

提问by jkjmr6

I'm going to be collaborating on a project using Laravel and PHPStorm. After doing some research and working on a few projects, here is the .gitignoreI've come up with so far.

我将在一个使用 Laravel 和 PHPStorm 的项目上进行合作。经过一些研究和一些项目的工作后,这是.gitignore我迄今为止提出的。

/bootstrap/compiled.php
/vendor
/node_modules
composer.phar
composer.lock
.env.*.php
.env.php
.DS_Store
workspace.xml
Thumbs.db

Are there any other files that I might be overlooking that could cause conflicts?

是否还有其他我可能忽略的文件可能会导致冲突?

EDIT:

编辑:

For anyone wondering why Flosculus comment is there, I originally posted that I was having issues with the .idea/workspace file showing up in my git history, and his answer is how to remove it.

对于任何想知道为什么 Flosculus 评论在那里的人,我最初发帖说我的 .idea/workspace 文件出现在我的 git 历史记录中,他的回答是如何删除它。

回答by Chris

Unless PHPStorm is an official part of the project (e.g. it's mandated by a company, or agreed to by all team members) I would urge you to put its ignore settings into .git/info/excludeinstead of .gitignore. The former is local to your copy, the latter should be committed and shared.

除非PHPStorm是该项目的正式组成部分(例如,它是由公司规定,或由所有团队成员一致同意),我会劝你把它忽略设置成.git/info/exclude代替.gitignore。前者在你的副本中是本地的,后者应该被提交和共享。

gitignore.iosuggests this for Laravel:

gitignore.io为 Laravel建议:

# Created by https://www.gitignore.io/api/laravel

### Laravel ###
vendor/
node_modules/
npm-debug.log

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
public/storage
public/hot
storage/*.key
.env.*.php
.env.php
.env
Homestead.yaml
Homestead.json

# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
.rocketeer/

and this for PHPStorm:

本作PHPStorm

# Created by https://www.gitignore.io/api/phpstorm

### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

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

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.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:
*.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

### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

As an aside, gitignore.io can be accessed via the command-line, so you can do things like

顺便说一句,gitignore.io 可以通过命令行访问,因此您可以执行以下操作

gi laravel,phpstorm >> .gitignore

It's a pretty handy little tool.

这是一个非常方便的小工具。

回答by Flosculus

rm -rf .idea
git-ignore .idea/
git commit -a -m 'deleted and ignored .idea/'

Reload project.

重新加载项目。