How to INCLUDE lib files inside folder in a Git repository

I have a Git repository that contains a Libs directory in the root. This directory contains all the compiled .lib files that I want to include in the repository and push to main repo. The structure of Libs directory is:

Libs
…–| x64
……..–| Release
……..–| Debug

  • Run “git pull --rebase” in interactive mode?
  • Clean history : remove delete actions and ignore some files
  • GIT: determine revision based on a file
  • How to Connect Visual Studio 2012 with git (github)?
  • Releasing multiple Maven artifacts when using nested Git submodules
  • GIT-SVN clone command executes without errors but the local master branch is missing
  • The problem is that I am unable to make Git include LIB files inside Release and Debug folders. I think its because Release and Debug folders are excluded by gitignore:

    # Build results
    [Dd]ebug/
    [Rr]elease/
    x64/
    build/
    [Bb]in/
    [Oo]bj/
    

    What I tried:

    !/Libs/*/*.lib
    !/Libs/x64/Release/*
    

  • why does netbeans 8 want to install unused cordova plugins
  • Is it possible to get the time/date of a commit knowing the commit hash but without access to the repository?
  • How to solve “error: unable to push to unqualified destination: HEAD”
  • How do I fix a broken git merge from the wrong origin branch?
  • cygwin git “Protocol ”https“ not supported or disabled in libcurl”
  • GIT - copy newest branch to another directory
  • One Solution collect form web for “How to INCLUDE lib files inside folder in a Git repository”

    You would need to use:

    git add --force Libs
    

    In order to add them in spite of the .gitignore.

    You can check at any time which .gitignore and which rules of the .gitignore is preventing you to consider a particular folder with:

    git check-ignore -v /path/to/an/element
    

    For modifying your .gitignore to not ignore a particular sub-folder, consider “.gitignore exclude folder but include specific sub-folder”, especially:

    If you exclude folder/, then everything under it will always be excluded (even if some later negative exclusion pattern (“unignore”) might match something under folder/). (*)
    (*: unless certain conditions are met in git 2.?, see below)

    For instance, in your case try (git 1.8.2+):

    Libs/**/*
    !Libs/x64/Release/
    

    Note that with git 2.9.x/2.10 (mid 2016?), it might be possible to re-include a file if a parent directory of that file is excluded if there is no wildcard in the path re-included.

    Nguyễn Thái Ngọc Duy (pclouds) is trying to add this feature:

    • commit 506d8f1 for git v2.7.0, reverted in commit 76b620d git v2.8.0-rc0
    • commit 5e57f9c git v2.8.0-rc0,… reverted(!) in commit 5cee3493 git 2.8.0-rc4.

    That means, with git 2.9+, this could have worked:

    /Libs
    !/Libs/x64/Release
    
    Git Baby is a git and github fan, let's start git clone.