git 如何在 IntelliJ IDEA 中将文件/文件夹添加到 .gitignore?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22585818/
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
How to add files/folders to .gitignore in IntelliJ IDEA?
提问by piotrek
I try to switch from Eclipse to IntelliJ IDEA. I have a project that uses Git and I want to quickly add files to .gitignorefile. In Eclipse I can right click on a file/directory and choose 'Add to .gitignore'.
我尝试从 Eclipse 切换到 IntelliJ IDEA。我有一个使用 Git 的项目,我想快速将文件添加到.gitignore文件。在 Eclipse 中,我可以右键单击文件/目录并选择“添加到 .gitignore”。
Is there anything like this in IntelliJ IDEA or I have to edit the file manually?
IntelliJ IDEA 中是否有类似的内容,或者我必须手动编辑文件?
回答by Rolf
IntelliJ has no option to click on a file and choose "Add to .gitignore" like Eclipse has.
IntelliJ 无法像 Eclipse 一样单击文件并选择“添加到 .gitignore”。
The quickest way to add a file or folder to .gitignorewithout typos is:
将文件或文件夹添加到.gitignore 且没有拼写错误的最快方法是:
- Right-click on the file in the project browser and choose "Copy Path" (or use the keyboard shortcut that is displayed there).
- Open the .gitignorefile in your project, and paste.
- Adjust the pasted line so that it is relative to the location of the .gitignorefile.
- 右键单击项目浏览器中的文件并选择“复制路径”(或使用显示在那里的键盘快捷键)。
- 打开项目中的.gitignore文件,然后粘贴。
- 调整粘贴的行,使其相对于.gitignore文件的位置。
Additional info: There is a .ignorepluginavailable for IntelliJ which adds a "Add to .gitignore" item to the popup menu when you right-click a file. It works like a charm.
附加信息:有一个可用于 IntelliJ的.ignore插件,当您右键单击文件时,它会在弹出菜单中添加一个“添加到 .gitignore”项目。它就像一个魅力。
回答by biniam
Intellij had .ignore
plugin to support this.
https://plugins.jetbrains.com/plugin/7495?pr=idea
Intellij 有.ignore
插件来支持这一点。
https://plugins.jetbrains.com/plugin/7495?pr=idea
After you install the plugin, you right click on the project and select new
-> .ignore file
-> .gitignore file (Git)
安装插件后,右键单击项目并选择new
-> .ignore file
->.gitignore file (Git)
Then, select the type of project you have to generate a template and click Generate
.
回答by nanotexnik
You can create file .gitignore and then Idea will suggest you install plugin
您可以创建文件 .gitignore 然后 Idea 会建议您安装插件
回答by TechPassionate
回答by mancini0
I'm using intelliJ 15 community edition and I'm able to right click a file and select 'add to .gitignore'
我正在使用 intelliJ 15 社区版,我可以右键单击一个文件并选择“添加到 .gitignore”
回答by Pavan
right click on the project create a file with name .ignore, then you can see that file opened.
右键单击项目创建一个名为 .ignore 的文件,然后您可以看到该文件已打开。
at the right top of the file you can see install plugins or else you can install using plugins(plugin name - .ignore).
在文件的右上角,您可以看到安装插件,否则您可以使用插件(插件名称 - .ignore)进行安装。
Now when ever you give a right click on the file or project you can see the option call add to .ignore
现在,当您右键单击文件或项目时,您可以看到选项调用添加到 .ignore