I have two files I wish to ignore:
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?
gitignore file is usually placed in the root directory of a project. You can also create a global . gitignore file and any entries in that file will be ignored in all of your Git repositories. To create a local .
Some times, even if you haven't added some files to the repository, git seems to monitor them even after you add them to the . gitignore file. This is a caching issue that can occur and to fix it, you need to clear your cache.
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.
This has changed in git 1.8.4
Use of platform fnmatch(3) function (many places like pathspec matching, .gitignore and .gitattributes) have been replaced with wildmatch, allowing "foo/**/bar" to match "foo/bar", "foo/a/bar", etc.
**/.idea/workspace.xml
should work now in this example.
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