How to use the. Ignore plugin in IntelliJ idea to ignore files that do not have to be submitted

Source: Internet
Author: User
Tags commit

Reprinted from: http://blog.csdn.net/qq_34590097/article/details/56284935

Recently learned git, and in the use of the IDE is IntelliJ idea, found that idea in the submission of the project to the local warehouse, the content of the. Idea folder will also be submitted, which contains some of the project configuration information, including history, version control information, and so on. You can not upload it to git.
At this point, you need to write a. gitignore file to ignore committing these files. There is a plugin in idea. Ignore can help us do this.

First look at how to install.

Click File->settings

On the left menu, find plugins, click Browse Repositories ...

Search. Ignore, click Install, after the installation is ready to use happily, but before you have to restart idea

However, the above method may be error-activated when the idea is installed. (′ཀ ' "∠) _ Do not hit me, as to why I do not know. Then give you planb:https://plugins.jetbrains.com/idea/plugin/7495–ignore.
Go to this URL to download the ZIP package, select Install plugin from disk.

Restart the end of the real can use ~.

Right-click on Project->new->.ignore file->.gitignore file (Git)

First select the example user template, then what you want to filter can be added by themselves, ~ Last click Generate Generate


Then you will find that the ignored file name becomes gray with wood. And can happily submit the code ~

You can also right-click the file to add it to the ignored list

Here are some matching rules that are ignored by the. gitignore file:

*.a       # ignores all. A end-of-file
!lib.a    # but LIB.A except
/todo     # simply ignores the TODO file under the project root directory, Excluding Subdir/todo
build/    # ignores all files in the build/directory
Doc/*.txt # ignores Doc/notes.txt but does not include Doc/server/arch.txt

The. Gitignore can only ignore files that were not previously track, and if some files have already been included in version management, modify the. Gitignore is invalid. The workaround is to first delete the local cache (to change to a non-track state) before committing:
Input:
Git rm-r–cached filePath
Git commit-m "Remove xx"
Or:
Git rm-r–cached.
git Add.
Git commit-m "update. Gitignore"

To explain the next few parameters-R is to delete the folder and its subdirectories –cached is to delete files in the staging area and not delete files in the workspace, the first is to delete a file, the second method of all the staging area in the file deleted, and then add again, equivalent to update again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.