Reputation: 1387
I'm trying to ignore some folders in my .gitignore with the specific pattern format /**/
(I found the docs here : http://git-scm.com/docs/gitignore) like this :
src/**/Entity/*.php~
But when I do a git status
in the terminal, It return to me this:
Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# src/AVC/MediasBundle/Entity/CapturePhotoVideo.php~
# src/AVC/MediasBundle/Entity/CodeReconnaissanceVocale.php~
# src/AVC/MediasBundle/Entity/CodeTraduction.php~
# src/AVC/MediasBundle/Entity/DetailTransaction.php~
# src/AVC/MediasBundle/Entity/Langue.php~
# src/AVC/MediasBundle/Entity/Media.php~
# src/AVC/MediasBundle/Entity/MediaLangue.php~
# src/AVC/MediasBundle/Entity/Offre.php~
# src/AVC/MediasBundle/Entity/QualiteVideo.php~
# src/AVC/MediasBundle/Entity/SousTitre.php~
# src/AVC/MediasBundle/Entity/Transaction.php~
# web/images/logo_black.svg
Or each folder in src/AVC/MediasBundle/Entity/....php~
shouldn't appear ...
But if in my .gitignore I replace le line src/**/Entity/*.php~
by this line src/AVC/MediasBundle/Entity/*.php~
everything works good !
Why doesn't the pattern format **
work here?
Upvotes: 1
Views: 185
Reputation: 137058
The ignore pattern in your question works as expected for me with Git 2.1.0. I'm not sure why it isn't working for you.
Your version of Git is quite old (the source code seems to have been released mid-2012). It is probably worth upgrading to the latest version that is available for your operating system and seeing if that fixes things.
I just don't want to upload temporary files on my repository.
In this case I would advise a simpler pattern:
*~
This very common ignore pattern simply ignores all files ending in ~
.
Upvotes: 1
Reputation: 387
I just tested this in a test repo, and this works for me:
.gitignore
src/**/*.php~
My guess would be that adding the extra directory with a double *
is causing some issues.
Upvotes: 1