What's the right way to ignore a certain filetype in a certain directory and all subdirectories in it?
Example: ignore all .xml
files in master/xyz/
and all subdirectories in master/xyz/
.
I'm not sure which of the following two approaches is the right one...
master/xyz/*/*.xml
master/xyz/**/*.xml
Which one should I use?
(I use Git 1.9.1)
gitignore file is usually placed in the repository's root directory. However, you can create multiple . gitignore files in different subdirectories in your repository.
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. If a file is added, committed and another commit with the . gitignore is created, the file will still be part of the repository and therefore cloned.
You can add something like this, it will work as of git 1.8.2.1 (documentation here)
A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
# should work
master/xyz/**/*.xml
The first suggestion you posted won't work as it will not match anything (as it is a literal)
# wont work
master/xyz//.xml
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