How to ignore parent directory in .gitignore
?
I tried this patterns, but seems they are don't work:
/../*
../
../*
How to ignore parent directory in .gitignore
?
I tried this patterns, but seems they are don't work:
/../*
../
../*
If you want to ignore a folder but don't want to modify an existing .gitignore, drop a .gitignore in the folder containing only an asterisk.
*
Here is a quick BASH example to accomplish this task for the .idea folder:
$ echo '*' > .idea/.gitignore
You can't, if you want your .gitignore
to be versioned.
And if it is versioned, that means elements of the parent folder is versioned as well (and cannot be ignored without removing from the index all of its content).
Kingcrunch comments you could still version the .gitignore
with a git add -f
, but as commented before, this would be quite confusing.
If it best to place the .gitignore
in the parent folder of the folder you want to ignore.
And there declare the name of the folder you want to ignore:
folder_to_ignore/
(Note the final '/
')