- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的团队目前管理跨多个文件系统的 git 存储库。我们大多数人使用 Windows,但我们中的一些人使用 Linux。另外,我们将生产代码部署在 Linux 服务器上。这导致了我们代码库中文件名大小写的多个问题(即,当文件实际上是 Foo.js
时导入 foo.js
)。最近,我完成了对项目文件夹的清理工作,主要包括重新组织目录并将目录/文件重命名为通用命名标准。许多文件名更改正在改变文件的大小写(例如 foo.js
-> Foo.js
)。
当我进行这些更改时,我并不完全了解 git 如何在区分大小写和不区分大小写的文件系统上以不同的方式处理文件名,这导致了很多奇怪的错误。我在研究这个时遇到的一件事是 ignorecase
中的 .gitconfig
值。
从 git-config 文档:
Internal variable which enables various workarounds to enable Git to work better on filesystems that are not case sensitive, like APFS, HFS+, FAT, NTFS, etc. For example, if a directory listing finds "makefile" when Git expects "Makefile", Git will assume it is really the same file, and continue to remember it as "Makefile".
…
Git relies on the proper configuration of this variable for your operating and file system. Modifying this value may result in unexpected behavior.
ignorecase = true
将使得如果 git 检测到相同的文件名但大小写不同,它将更改 git 索引中的名称以匹配文件系统上的内容(即,如果 Windows有
foo.js
和 git checkout/pull 有
Foo.js
,它会假设
foo.js
是正确的,git 将使用那个大小写)。我担心的是如果我推送到远程并且我们的部署服务器接受更改会发生什么。然后它会尝试导入不存在的
Foo.js
并出错。
ignorecase = false
,git 应该能够检测到文件名存在差异并正确替换文件。这是正确的,我是否应该让我的团队将此值设置为 false,因为我们跨不同的文件系统工作?
最佳答案
From what I'm able to understand from this, setting ignorecase = true will make it so that if git detects the same file name but with different casing, it will change the name in the git index to match what is on the filesystem (i.e. if Windows has
foo.js
and a git checkout/pull hasFoo.js
, it will assume thatfoo.js
is correct and git will use that casing).
Foo.js
,无论出于何种原因,工作树都有
foo.js
, Git 会假设
foo.js
真的是
Foo.js
并将把
Foo.js
进入下一次提交。与
core.ignorecase
设置为
false
,然而,Git 完全相信工作树:
git add .
将删除大写名称(和内容)并使用小写名称
foo.js
根据工作树中的副本在索引中安装新副本。
git ls-files --stage
,或省略
--stage
以仅获取文件名。请注意,这会转储整个索引内容!添加路径参数以选择特定文件,例如,
git ls-files "[Ff]oo.js"
,只查找那些文件。在类 Unix 的 shell 中需要引号,例如 bash,以防止 shell 在此处解释元字符
[Ff]
。shell 将删除引号。在其他 Windows 特定命令中使用什么行口译员,我不确定。)
core.ignorecase
.如果要重命名文件,最直接的方法是使用
git mv
(同时调整索引和工作树)。如果您只想更改大小写,您可以
git mv
两次:
git mv foo.js temporary-name
git mv temporary-name Foo.js
Foo.js
在索引和工作树中都有一个初始资本。某些版本的 Git 或许可以在没有中间临时名称的情况下处理这个问题,但是当您使用中间名称时,所有版本都会做正确的事情。
关于git - 将 git config core.ignorecase 设置为 false 是个好主意吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58192285/
主要思想是将 EF Core nuget 包添加到 .NET Core 库项目,然后在一堆应用程序(例如 ASP.NET Core、Win 服务、控制台应用程序)中使用该库,而无需在每个应用程序中配置
我想要实现的是编写一个简单的.net核心后台工作程序(.net core 3.1)的代码,在该工作程序作为Windows服务运行时,我在其中将数据写入SQL Server数据库(通过EF Core 3
关于 .Net Core SDK download page 二进制文件有什么用?它与安装程序有何不同? 最佳答案 二进制文件是 .NET Core 的编译代码。它们拥有运行 .NET Core 所需
.NET Core 和 Entity Framework Core 之间的区别?我们可以在 .NET Core 中使用 Entity Framework Core 吗?两者都有什么优势? 最佳答案 E
.NET Core 和 ASP.NET Core 到底有什么区别? 它们是相互排斥的吗?我听说 ASP.NET Core 是基于 .NET Core 构建的,但它也可以基于完整的 .NET 框架构建。
我对 ASP.NET Core 开发完全陌生。我正在尝试使用单个模型和 mysql 创建一个简单的 asp.net core Web api 来存储模型数据,然后我想使用 Swagger 将其作为 R
.NET Core 和 Entity Framework Core 之间的区别?我们可以在 .NET Core 中使用 Entity Framework Core 吗?两者都有什么优势? 最佳答案 E
好吧,作为一个新的 .net 开发生态系统,我有点迷失在核心工具、版本等方面。 有人可以解释我之间的区别吗 VS 2015 核心工具预览版 x - See here .NET Core/SDK 与否
我已阅读有关如何通过信号器核心集线器从后台服务向客户端发送通知的文档。如何从客户端接收到后台服务的通知? 后台服务应该只是一个单例。 public class Startup { public
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 4年前关闭。 Improve t
非常简单的问题: 我正在尝试创建一个像这样的谓词构建器: var predicate = PredicateBuilder.False(); 但似乎在Net Core和EF Core中不可用。
在 .NET Core 自包含应用程序 中...我们需要在 project.json 中指定运行时 (RID) 我们希望我们的应用程序针对...发布为什么会这样? .NET Core 是跨平台的,与我
如何用 iCloud Core Data 替换我现有的 Core Data?这是我的持久商店协调员: lazy var persistentStoreCoordinator: NSPersistent
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 2 年前。 Improv
今天我正在学习新的 ASP.net 核心 API 3.1,我想将我的旧网站从 MVC4 转移到 Web API。除了一件事,一切都很好。数据库连接。在我的旧网站中,我为每个客户端(10/15 数据库)
我在 Visual Studio 2015 Update 3 和 .NET Core 1.0 中工作。我有一个 .NETCoreApp v1.0 类型的 Web API 项目。当我添加一个 .NET
我一直在尝试遵循 Ben Cull ( http://benjii.me/2016/06/entity-framework-core-migrations-for-class-library-proj
当我打开我的 vs 代码程序时,我收到以下消息: 无法找到 .NET Core SDK。 .NET Core 调试将不会启用。确保 .NET Core SDK 已安装并且在路径上。 如果我安装甚至卸载
我偶然发现了一个非常奇怪的问题。每当 Web 应用程序启动时,dotnet.exe 都会使用相当多的内存(大约 300M)。然而,当它触及某些部分时(我感觉这与 EF Core 使用有关),它会在短时
ASP.NET Core Web (.NET Core) 与 ASP.NET Core Web (.NET Framework) 有什么区别? .NET Framework 是否提供 similar
我是一名优秀的程序员,十分优秀!