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

22,530

Solution 1

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

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 .gitignore file.

Solution 2

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

Add vcs.xml to 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.

Use this .gitignore for all your Jetbrains based products: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and 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

Solution 3

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

So in your .gitignore you might ignore the files ending with .iws, and the workspace.xml and tasks.xml files. Here you can find a very good example of gitignore file for JetBrains IDEs.

Solution 4

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.

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

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

runConfigurations - this folder is for shared run configurations.

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

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

Share:
22,530
Stephen
Author by

Stephen

Almost completely self-taught. Always trying to reduce complex problems to simple ones.

Updated on March 20, 2020

Comments

  • Stephen
    Stephen over 4 years

    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?

  • information_interchange
    information_interchange over 6 years
    That's what I was thinking as well, but if you go to the github Jetbrains .gitignore, the vcs.xml entry is curiously missing: raw.githubusercontent.com/github/gitignore/master/Global/… Hence, it gets added to the repo on a git add *
  • Brent Writes Code
    Brent Writes Code about 6 years
    There's also a public .gitignore file on GitHub for all JetBrains products: github.com/github/gitignore/blob/master/Global/…
  • Jeff Padgett
    Jeff Padgett about 6 years
    Yes, but what IS the vcs.xml file? In other words, what project settings are stored there? What does it do?
  • Cerno
    Cerno over 5 years
    @Jeff Padgett VCS = Version Control System. The xml stores information about git or other vcs's settings. I would say if those are settings relevant for other devs then the vcs.xml should be checked in. I haven't worked with pycharm git integration yet so I can offer no experience here though.
  • Dean Gurvitz
    Dean Gurvitz over 4 years
    Not all files under the .idea file should be ignored, and even the ones that do don't need to be ignored in the same extent. A better answer would explain the file's purpose before stating a conclusion (which in this case I think is false)
  • Robert Christ
    Robert Christ almost 3 years
    bless you, this is exactly what I was looking for