git 如何在 Pycharm 中使用 gitignore?

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

How to use gitignore in Pycharm?

gitpycharmgitignore

提问by cb4

Similar questions like this oneabout how to ignore files in a git repo are typically answered by showing which git command to execute on the command line. Even this one, although it is PyCharm specific, does the same.

类似的问题,像这样的一个有关如何忽略一个混帐回购协议文件通常通过展示git的命令在命令行中执行哪个回答。即使是这个,虽然它是 PyCharm 特定的,但也是如此。

Is there a way to manage this file through the PyCharm GUI?

有没有办法通过 PyCharm GUI 管理这个文件?

回答by Gavin Munro

Try:

尝试:

  1. Go to Settings
  2. Go to Plugins
  3. Search for: .ignore
  4. Install
  5. Restart PyCharm
  1. 前往设置
  2. 转到插件
  3. 搜索:.ignore
  4. 安装
  5. 重启 PyCharm

.gitignoreshould now be included in .ignorealong with .hgignoreetc.

.gitignore现在应该.ignore.hgignore等一起包括在内。

回答by Makoto

There are plugins available in the JetBrains repository to manage this; one of them that I make use of is .ignore, which allows you to have more insight into what files you're actually ignoring in the IDE.

JetBrains 存储库中有可用的插件来管理它;我使用的其中之一是.ignore,它使您可以更深入地了解您在 IDE 中实际上忽略了哪些文件。

回答by adixxov

In PyCharm Pro 2019.3, I was able to do this by - right click folder or file I wanted to add to gitignore. - scroll to and click on Git - scroll to and click on Add to .gitignore If a gitignore file is not already there, PyCharm will create one and add it to the main project folder and add your chosen folder/file to it.

在 PyCharm Pro 2019.3 中,我可以通过右键单击要添加到 gitignore 的文件夹或文件来执行此操作。- 滚动到并单击 Git - 滚动到并单击添加到 .gitignore 如果 gitignore 文件不存在,PyCharm 将创建一个并将其添加到主项目文件夹并将您选择的文件夹/文件添加到其中。