gpt4 book ai didi

Git-缺少一些文件

转载 作者:太空狗 更新时间:2023-10-29 14:45:30 28 4
gpt4 key购买 nike

当我尝试将我的本地存储库推送到一个空的远程存储库时,我正在执行以下操作:

git add .
git status

当我运行 git status 时,我看到有些文件没有暂存,这是我的 git bash 和本地工作副本的屏幕截图:

Screeshot of git bash and my local working copy.

我的忽略文件:

*.*

#####Directories
!CefSharp/Internals/*
!CefSharp/Properties/*

!CefSharp.BrowserSubprocess/Properties/*

!CefSharp.Core/Internals/*
!CefSharp.Core/Win32/*

!CefSharp.Example/ExtensionMethods/*
!CefSharp.Example/Properties
!CefSharp.Example/Proxy
!CefSharp.Example/Resources

!CefSharp.WinForms/Internals/*
!CefSharp.WinForms/Properties/*

!CefSharp.WinForms.Example/Minimal/*
!CefSharp.WinForms.Example/Properties/*
!CefSharp.WinForms.Example/Resources/*
!CefSharp.WinForms.Example/Tools/*

!ipch/*
!packages/*
!Resources/*
!RexCao/Properties/*

!SysHandle/Properties/*

!TimesheetUpdater/Properties/*
!TimesheetUpdater/Resources/*
!TimesheetUpdater/Tools/*

!TSNetChecker/Properties/*
!TSNetChecker/Resource/*
!TSNetChecker/Resources/*
!TSNetChecker/Tools/*

!UIThreadTest/Properties/*

!Win32/*

#####Files
!CefSharp/*.cs
!CefSharp/*.csproj

!CefSharp.BrowserSubprocess/app*
!CefSharp.BrowserSubprocess/*.csproj
!CefSharp.BrowserSubprocess/*.cs

!CefSharp.BrowserSubprocess.Core/*.cpp
!CefSharp.BrowserSubprocess.Core/*.h
!CefSharp.BrowserSubprocess.Core/*.vcxproj.*
!CefSharp.BrowserSubprocess.Core/*.config

!CefSharp.Core/*.cpp
!CefSharp.Core/*.h
!CefSharp.Core/*.vcxproj.*
!CefSharp.Core/*.config

!CefSharp.Example/*.cs
!CefSharp.Example/*.csproj

!CefSharp.WinForms/*.csproj
!CefSharp.WinForms/*.cs

!CefSharp.WinForms.Example/*.cs
!CefSharp.WinForms.Example/app.*
!CefSharp.WinForms.Example/*.csproj.*
!CefSharp.WinForms.Example/*.ico
!CefSharp.WinForms.Example/*.config
!CefSharp.WinForms.Example/*.resx

!RexCao/*.cs
!RexCao/*.csproj

!SysHandle/*.cs
!SysHandle/*.csproj

!TimesheetUpdater/*.ico
!TimesheetUpdater/*.cs
!TimesheetUpdater/*.resx
!TimesheetUpdater/*.csproj

!TSNetChecker/*.cs
!TSNetChecker/*.resx
!TSNetChecker/*.ico
!TSNetChecker/*.csproj

!UIThreadTest/*.config
!UIThreadTest/*.cs
!UIThreadTest/*.resx
!UIThreadTest/*.csproj

!.gitignore
!*.ps1
!*.yml
!*.bat
!*.props
!*.snk
!*.sdf
!*.sln

我的问题是:为什么有些文件丢失了?

最佳答案

为了包含目录下的所有文件,您必须将其指定为:

!directory/**

不带单个星号 (*)。

既然你指定了忽略所有文件

*.*

除了你用爆炸(!)包含的那些,你必须正确指定你想要添加的文件。

背景

正如您在 specifications 中所读到的那样单个星号与目录下的文件直接匹配。不是子目录中的文件。

为了取消忽略目录中的所有文件,您需要使用两个连续的星号:

Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:

  • A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".

  • A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth.

  • A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.

Other consecutive asterisks are considered invalid.

关于Git-缺少一些文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30322696/

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