Why there is not ignore option after first commit ?
Answered
After first commit, in Local Changes pane, when I right click on files, there is no "add to gitignore" option
Please sign in to leave a comment.
Hello Mahmut716
Could you please provide steps to reproduce?
Are you trying to add to gitignore a file that has already been committed?
After first commit, when I try to commit second time, on Local Changes pane, right click on file and there is no "add to gitignore" option.
But this opiton exist when you committed first time.
Mahmut716 You cannot add to .gitgnore already committed file. If you want to add file to .gitignore after that's already committed please run:
git rm --cached filename
And then add to .gitgnore.
Why ? Is this not a bug or a feature to add ? For example, I add pdf or xml file to project for testing after first commit, do I need to clear cache after every .gitignore commit ?
Mahmut716
It is not possible to ignore files that are tracked by git. Git supports only ignoring unversioned files.
Please see and vote:
https://youtrack.jetbrains.com/issue/IDEA-21006