【问题标题】:Re-writing commit history ignoring a folder (in my case node_modules)重写提交历史忽略文件夹(在我的例子中是 node_modules)
【发布时间】:2021-01-29 06:42:20
【问题描述】:

我刚刚注意到我公司的初级开发人员正在从事的项目没有在项目开始时将node_modules添加到.gitignore文件中......现在我正在查看提交历史,我注意到git pull花了很多时间,也有很多变化,所以原因是他们没有忽略node_modules目录。

我想做的就是重写提交历史和git push --force,然后告诉他们git pull --rebase

如果没有 node_modules 文件夹,有没有办法重写该历史记录?

这里需要一个 Git 大师!

【问题讨论】:

标签: git


【解决方案1】:

您可以使用git filter-repo 重写历史记录。这是它的基本操作之一,请参考https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html的文档

(您也可以使用git filter-branch 执行此操作,但filter-branch 命令本身建议不要再使用它。)

【讨论】:

    猜你喜欢
    • 2015-02-17
    • 2020-05-28
    • 2019-03-19
    • 1970-01-01
    • 1970-01-01
    • 2015-07-01
    • 2021-01-03
    • 1970-01-01
    • 2018-01-12
    相关资源
    最近更新 更多