【问题标题】:Submodule is always modified even after hard resets即使在硬重置后,子模块也总是被修改
【发布时间】:2021-05-20 13:09:37
【问题描述】:

我的子模块显示为已修改(我没有触摸那里的任何东西)。我一直在尝试硬重置它无济于事:

~dom/gitmodules/emacswiki heads/master*
❯ git reset --hard upstream/master                                                                         141
HEAD is now at f54d96c32 How to grant GNU Emacs for OS X full disk access

~dom/gitmodules/emacswiki heads/master*
❯ git status -s                              
 M AucTeX
 M AutoLisp
...

我试过了:

cd ../
git submodule deinit -f .
git submodule update --init
git submodule update -f --recursive

同样,它什么也没做。

【问题讨论】:

  • gss 背后是什么? git status -s ?
  • @LeGEC 是的,对不起。
  • git reset --hard 只会影响 this 存储库;每个子模块都是其他的存储库。要查看其他存储库/ies 中发生了什么,请输入它们并运行 git status 并使用其他 Git 诊断程序。 (您可以使用一些递归选项让外部 Git 为您执行此操作,但总的来说,如果您在此处手动执行这些操作,您将获得更多控制权并了解更多事情。)
  • @torek 我已经在已修改文件的 repo 中运行了重置。其他子模块没有修改文件,根子模块只是显示该子模块为已修改。
  • 啊,那么dom/gitmodules/emacswiki 有问题的子模块吗?我看到了一些有趣的大写字母(AucTeXAutoLisp 等)。这是一个 Git 存储库,它通常是在区分大小写的系统(例如,在使用 Linux 文件系统的 Linux 上)上开发的,而您已克隆到不区分大小写的系统(典型的 macOS 或 Windows 文件系统)?或(和/或):您是否已将 Git 配置为在您的工作树中进行行尾操作?

标签: git git-submodules


【解决方案1】:

这个:

我是git://github.com/emacsmirror/emacswiki.org.git,是的,我在 macOS 上。

是关键。在 macOS 上克隆该存储库,并检查 f54d96c32 附近的一些提交,使用相当现代的 Git,但在大小写折叠文件系统上(作为 macOS 上的默认文件系统),会给出很多警告:

warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'Anything'
  'anything'
  'Artagnon'
  'artagnon'
  'AUCTeX'
  'AucTeX'
  'AutoLISP'
  'AutoLisp'
  'BookMarks'
  'Bookmarks'

[剪掉更多]

在区分大小写的文件系统上检查提交 f54d96c32,例如,我们可以比较 AutoLISP 与 AutoLisp 的两个文件:

$ file AutoLISP AutoLisp
AutoLISP: ASCII text
AutoLisp: ASCII text, with very long lines
$ cat AutoLISP
#REDIRECT AutoLisp
$ cat AutoLisp
AutoLisp is the API for the proprietary computer-aided design system, !AutoCAD. [snip]

要在 Mac 上正确轻松地检查这一点,您需要在区分大小写的文件系统中工作。例如,请参阅我对How do I change case of the names of multiple files, already committed?的回答

【讨论】:

    猜你喜欢
    • 2021-12-22
    • 1970-01-01
    • 1970-01-01
    • 2012-12-01
    • 1970-01-01
    • 2019-11-18
    • 2021-08-03
    • 2019-10-17
    • 1970-01-01
    相关资源
    最近更新 更多