windows - 如何重写历史以删除 git 中的可执行位

标签 windows git executable git-filter-branch

我已经将一个相当大的存储库从另一个 SCM 导入到 git 中。不幸的是,迁移是在 Windows 上完成的(必须是),并且每个文件都已提交到 git 并设置了执行位。为了避免再次进行迁移(这是一个漫长且容易挂起的过程),我试图弄清楚我是否可以清除服务器端的可执行位。我的想法是以某种方式将 git filter-branch 与 git update-index 结合使用,但我可以得到有关如何继续的提示。

在最后清除所有可执行位进行大量提交不是解决方案——我不希望每个文件在历史记录中都有一个颠簸。

最佳答案

这似乎可以解决问题:

git filter-branch --index-filter 'git ls-files -s  |
                                  sed s/^100755/10644/ |
                                  git update-index --index-info' -- --all

关于windows - 如何重写历史以删除 git 中的可执行位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6545631/

相关文章:

windows - 为什么 "Git help <command>"没有像它说的那样在我的浏览器中启动 html 帮助?

git - 如何解决 git 在被拒绝的标签上停止

linux - 如何从 Linux 命令行获取 exe 的编译日期

c++ - SetWindowsHookEx() 监控所有线程 : Must the hook procedure be located in a DLL?

php - File_get_contents 函数不适用于 Windows?

git - 两个master一起使用git的方法

linux - Linux 应用程序的虚拟地址重整

c - fgetc 需要 'enter' 在 WINDOWS 上按两次键

java - 扫描仪对象错误

java - 可执行 jar 文件未运行