0

I am using IntelliJ IDEA but when I want commit it shows all class file. Here is the image;

enter image description here

Here is the gitignore code...

        ELP.md
    target/
    !.mvn/wrapper/maven-wrapper.jar
    !**/src/main/**/target/
    !**/src/test/**/target/

    ### STS ###
    .apt_generated
    .classpath
    .factorypath
    .project
    .settings
    .springBeans
    .sts4-cache

    ### IntelliJ IDEA ###
    .idea
    *.iws
    *.iml
    *.ipr
    *.logs


    /logs/*
    /logs/
    ### NetBeans ###
    /nbproject/private/
    /nbbuild/
    /dist/
    /nbdist/
    /.nb-gradle/
    build/
    !**/src/main/**/build/
    !**/src/test/**/build/

    ### VS Code ###
    .vscode/

What is the reason to show class file...

Please help me...

1
  • 2
    Are you sure they are not in the git history? It flagging them as changed indicates they have been added already thus will not be ignored by git and so IntelliJ too
    – Randommm
    Commented May 15 at 7:14

1 Answer 1

2

I assume you want to ignore the target/ directory. Your .gitignore is configured properly. As @randommm suggested, you must've already staged target/ directory before.

A simple fix would be to run:

git rm -r --cached .

This command removes everything from the index. You should no longer see the target/ directory in tracked files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.