I am working on a maven project and I want to ignore the files generated and stored in the /target folder of my project (Evaluation) root folder.In the root of my git repository I have a .gitignore file with the following entries (backend is just a folder which contains the eclipse project Evaluation)
backend/Evaluation/logs/ backend/Evaluation/target/
For some reason SourceTree does not ignore the files stored in these two folders and when I compile my project there are some uncommitted changes which are some .class files inside the /target folder.
Why is this happening ? I also tried to change the .gitignore entries to
/backend/Evaluation/logs/**
but it did not work too.
Any ideas ?
Easiest way to edit the individual, is right click the file. Click Ignore and select the option to ignore just in this repository then you will see a new file called . gitignore in the list. If you have accidentally already added them to the list.
Take a good look at your structure, and make sure you're trying to ignore the file that isn't already committed to your repository. If it is, remove the file from the repository and try again. This should fix the Gitignore not working issue.
gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.
Because there is the Sourcetree tag in the question I will answer you how to do this with Sourcetree, it's really simple.
As said before you first have to remove the file from tracking and then make Sourcetree to ignore the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With