如何在Git存储库的[/Libs/x64/Release]文件夹中包含lib文件 [英] How to INCLUDE lib files inside [/Libs/x64/Release] folder in a Git repository

查看:137
本文介绍了如何在Git存储库的[/Libs/x64/Release]文件夹中包含lib文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Git存储库,该存储库的根目录中包含一个 Libs 目录.该目录包含所有要包含在存储库中并推送到主存储库的已编译.lib文件. 目录的结构为:

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:


...-- | x64
........-- |发布
........-- |调试

Libs
...--| x64
........--| Release
........--| Debug

问题是我无法让Git在 Release Debug 文件夹中包含LIB文件.我认为是因为gitignore排除了Release和Debug文件夹:

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/

我尝试过的:

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

推荐答案

您将需要使用:

git add --force Libs

尽管添加了.gitignore,也要添加它们.

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

您可以随时检查哪个.gitignore以及.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

要修改您的.gitignore使其忽略特定的子文件夹,请考虑" .gitignore exclude文件夹,但包含特定的子文件夹",尤其是:

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

如果排除了folder/,则将始终排除其下的所有内容(即使某些后来的否定排除模式(忽略")可能与folder/下的内容匹配). (*)
(*:除非git 2中满足某些条件??,请参见下文)

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)

例如,在您的情况下,请尝试(git 1.8.2 +):

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

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

请注意,使用git 2.9.x/2.10(2016年中吗?),如果排除了该文件的父目录,则可能可以重新包含该文件

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ễnTháiNgọcDuy(pclouds)试图添加此功能:

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.

这意味着,在git 2.9+上,这可能行得通:

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

/Libs
!/Libs/x64/Release

这篇关于如何在Git存储库的[/Libs/x64/Release]文件夹中包含lib文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆