How can I ignore a certain filetype only in one directory and its sub-directory?
To explain what I mean imaging the following setup
I want to be able to do is tell git (using .gitignore file) to ignore *.iml but only under the directory foldtertoignore.
I was thinking this would work
foldertoignore/*.iml
But that only found ignoreme1.iml not ignoreme2.iml
I know how to tell it to ignore *.iml except for a specific directory. This is the reverse of that. Any thoughts?
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.
gitignore file is usually placed in the repository's root directory. However, you can create multiple . gitignore files in different subdirectories in your repository.
gitignore file is a plain text file that contains a list of all the specified files and folders from the project that Git should ignore and not track. Inside . gitignore , you can tell Git to ignore only a single file or a single folder by mentioning the name or pattern of that specific file or folder.
Use an exclude file The exclude file lets Git know which untracked files to ignore and uses the same file search pattern syntax as a . gitignore file. Entries in an exclude file only apply to untracked files, and won't prevent Git from reporting changes to committed files that it already tracks.
.gitignore
rules are applied recursively from the containing directory. Simply create the file foldertoignore/.gitignore
with *.iml
as contents.
>>foldertoignore/.gitignore echo '*.iml'
git add foldertoignore/.gitignore
git commit -m 'Ignore .iml files in foldertoignore and its subfolders'
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