如何从历史记录中删除回购中不再存在的文件的提交
How to remove commits from history for the files that no longer exist in the repo
所以我的 Github 存储库包含许多多年来的项目,现在只剩下几个了。是否可以清理我的提交历史记录,而不是关于 files/projects 的数千个提交不再存在于此 repo 中,减少到大约一百个与剩余的几个项目中的文件有关的提交。
谢谢。
可以考虑new git filter-repo
, which will replace the old git filter-branch
or BFG.
它有 many usage examples,包括 path-based 过滤:
To keep all files except these paths, just add --invert-paths:
git filter-repo --path README.md --path guides/ --path tools/releases --invert-paths
所以我的 Github 存储库包含许多多年来的项目,现在只剩下几个了。是否可以清理我的提交历史记录,而不是关于 files/projects 的数千个提交不再存在于此 repo 中,减少到大约一百个与剩余的几个项目中的文件有关的提交。 谢谢。
可以考虑new git filter-repo
, which will replace the old git filter-branch
or BFG.
它有 many usage examples,包括 path-based 过滤:
To keep all files except these paths, just add --invert-paths:
git filter-repo --path README.md --path guides/ --path tools/releases --invert-paths