.gitignore pattern format ** doesn't work

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 :


But when I do a git status in the terminal, It return to me this:

  • can I retrieve version of file from git for a given date?
  • gitk equivalent of git log --follow <full path to file>
  • Configure git secondary repo
  • Why does git run auto-packing on every push to our repo?
  • Is it possible to pre-evaluate a value in bash's PS1?
  • Jenkins job was poked by a GitHub webhook but didn't start
  • 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?

  • New git repository error on first push
  • 'git submodule update --init --recursive' VS 'git submodule foreach --recursive git submodule update --init'
  • git clone timed out when used through https proxy
  • Is it possible to have files from multiples paths into one git repository?
  • Git rename directory with submodules
  • Git: How to rebase to a specific commit?
  • 2 Solutions collect form web for “.gitignore pattern format ** doesn't work”

    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 ~.

    I just tested this in a test repo, and this works for me:



    My guess would be that adding the extra directory with a double * is causing some issues.

    Git Baby is a git and github fan, let's start git clone.