Pycharm 问我是否想将 .idea\vcs.xml 添加到 Git

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45198277/
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-09-19 12:49:44  来源:igfitidea点击:

Pycharm asks me if I want to add .idea\vcs.xml to Git

gitpycharmjetbrains-ide

提问by Stephen

When using Pycharm I got a popup out of nowhere asking me if I wanted to add this file to Git, and noting that I could do it manually later if I wanted. What is this file, and why is this recommendation being given to me?

使用 Pycharm 时,突然出现一个弹出窗口,询问我是否想将此文件添加到 Git,并指出如果需要,我可以稍后手动执行。这是什么文件,为什么要向我提供此建议?

采纳答案by Saurabh Shrivastava

All the project specific settings for project are stored under the .idea folder.

项目的所有项目特定设置都存储在 .idea 文件夹下。

While working, a new file (vcs.xml) was created and hence it gives you the option to add it to Git. The files in the .idea/should generally not reach Git, and it's usually better to add it to .gitignorefile.

在工作时,vcs.xml创建了一个新文件 ( ),因此您可以选择将其添加到 Git。中的文件.idea/通常不应该到达 Git,通常最好将其添加到.gitignore文件中。

回答by Saravanabalagi Ramachandran

If you gitignore the .ideafolder then others will notbe able to access project specific settings like run configuration, environment variables, build settings, etc., and other miscellaneous additions like project specific dictionaries.

如果您 gitignore.idea文件夹,则其他人将无法访问项目特定设置,如运行配置、环境变量、构建设置等,以及其他杂项添加,如项目特定字典。

Add vcs.xmlto your project and don't entirely gitignore .idea. In fact, Jetbrains recommends to ignore some files (listed below) while still adding the rest to the repo.

添加vcs.xml到您的项目中,不要完全使用 gitignore .idea。事实上,Jetbrains 建议忽略一些文件(如下所列),同时仍将其余文件添加到 repo 中。

Use this .gitignorefor all your Jetbrains based products: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm

将此.gitignore用于所有基于 Jetbrains 的产品:IntelliJ、RubyMine、PhpStorm、AppCode、PyCharm、CLion、Android Studio 和 WebStorm

Just in case the link becomes invalid for any reason I'm pasting it directly here

以防万一链接因任何原因无效,我直接将其粘贴到此处

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

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

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

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

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

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

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

# Editor-based Rest Client
.idea/httpRequests

For more details, refer to Jetbrains Support Article

有关更多详细信息,请参阅Jetbrains 支持文章

回答by grundic

There is good official descriptionfrom JetBrains of which files to put into git.

JetBrains 对将哪些文件放入 git有很好的官方描述

So in your .gitignoreyou might ignore the files ending with .iws, and the workspace.xmland tasks.xmlfiles. Hereyou can find a very good example of gitignore file for JetBrains IDEs.

因此,在您.gitignore的文件中.iws,您可能会忽略以, 和workspace.xmltasks.xml文件结尾的文件。在这里您可以找到一个非常好的 JetBrains IDE 的 gitignore 文件示例。

回答by Arnab

The .idea folder (hidden on OS X) in the solution root contains IntelliJ's project specific settings files. These include per-project details such as VCS mapping and run and debug configurations, as well as per-user details, such as currently open files, navigation history and currently selected configuration.

解决方案根目录中的 .idea 文件夹(隐藏在 OS X 上)包含 IntelliJ 的项目特定设置文件。其中包括每个项目的详细信息,例如 VCS 映射和运行和调试配置,以及每个用户的详细信息,例如当前打开的文件、导航历史记录和当前选择的配置。

Some files should be committed to source control, some should be excluded. Usually, one needs to share the following:

一些文件应该提交给源代码控制,一些文件应该被排除在外。通常,需要分享以下内容:

indexLayout.xml - this file is for the information about external folders attached to the solution, which are not the part of a .NET project. Such folders can be added via right-click on a solution -> “Attach Existing Folder...”.

indexLayout.xml - 此文件用于提供有关附加到解决方案的外部文件夹的信息,这些文件夹不是 .NET 项目的一部分。可以通过右键单击解决方案 ->“附加现有文件夹...”来添加此类文件夹。

vcs.xml - this file is for VCS-related internal information, as which VCS is enabled, etc.

vcs.xml - 此文件用于提供与 VCS 相关的内部信息,例如启用了哪个 VCS 等。

runConfigurations - this folder is for shared run configurations.

runConfigurations - 此文件夹用于共享运行配置。

Other files inside of .idea folder can be safely excluded from VCS (ex. modules.xml and riderModule.iml), as Rider can generate them again.

.idea 文件夹中的其他文件可以安全地从 VCS 中排除(例如 modules.xml 和 RiderModule.iml),因为 Rider 可以再次生成它们。

Per JetBrains, below files can be safely excluded: https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore

根据 JetBrains,可以安全地排除以下文件:https: //github.com/github/gitignore/blob/master/Global/JetBrains.gitignore