I have two files I wish to ignore:
- .idea/workspace.xml
- someapp/src/.idea/workspace.xml
I thought adding this single rule to .gitignore will suffice:
.idea/workspace.xml
But it only catches the top-level .idea/workspace.xml (git status shows someapp/src/.idea/workspace.xml as untracked).
I also tried **/.idea/workspace.xml, but this doesn’t work at all. Help?
As soon as the path contains a slash, Git will no longer check for a match in the path but instead will use the glob behaviour directly. As such, you cannot match for
.idea/workspace.xmlbut only forworkspace.xml.Git manual: gitignore.