Ignore Files or Folders from Git - Git Ignore or Exclude

In your projects .git\info directory there is an exclude file that is effectively the same thing as .gitignore (I think). You can add files and directories to ignore in that.

Suppose, I want exclude target/classes folder from my project abc.

File Structure :

abc
|
|
target     src     resources   .git
|                                          |
|                                          |
classes   repo   lib              info
                                           |
                                           |
                                           exclude (file)

Now, inside abc there is a .git folder and inside of that there is info folder. Inside the info folder, there is exclude file.

Open it and add the following to ignore target/classes folder from above example.

$: vi exclude

/target/classess

Done. Similarly add the folder as per your project structure to exclude or ignore it from git.