gpt4 book ai didi

git - 如何在 Git 存储库的 [/Libs/x64/Release] 文件夹中包含 lib 文件

转载 作者:太空狗 更新时间:2023-10-29 13:53:23 26 4
gpt4 key购买 nike

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


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

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

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

我尝试过的:

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

最佳答案

你需要使用:

git add --force Libs

为了在 .gitignore 中添加它们。

您可以随时检查哪个 .gitignore 和 .gitignore 的哪些规则阻止您考虑使用以下内容的特定文件夹:

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

要将您的 .gitignore 修改为忽略特定的子文件夹,请考虑“.gitignore exclude folder but include specific sub-folder”,尤其是:

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+):

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

请注意,使用 git 2.9.x/2.10(2016 年年中?),如果文件的父目录被排除在外,则可能会重新包含该文件 if there is no wildcard in the path re-included .

Nguyễn Thái Ngọc Duy (pclouds)正在尝试添加此功能:

这意味着,对于 git 2.9+,这可能有效:

/Libs
!/Libs/x64/Release

关于git - 如何在 Git 存储库的 [/Libs/x64/Release] 文件夹中包含 lib 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23821270/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com