bgf cleaner 不更新拉取请求

bgf cleaner does not update pull requests

我正在使用 bfg-cleaner 从 github 中删除一些包含敏感信息的文件。除了拉取请求外,它工作正常。敏感日期仍然存在于 pull requests 中。我怎样才能摆脱这个?

首先,你可以考虑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 aFileToRemove --invert-paths

其次,关于pull-requests,你需要fetch them first

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@github.com:joyent/node.git
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*  <====

# Now fetch all the pull requests:

$ git fetch origin
From github.com:joyent/node
 * [new ref]         refs/pull/1000/head -> origin/pr/1000
 * [new ref]         refs/pull/1002/head -> origin/pr/1002

然后,在过滤之后,您将需要强制推回所有内容。

作为torek notes in :

In this case, if someone is rewriting a repository to delete sensitive data, and someone else has made a PR, the sensitive data might be in the someone-else's repository.

所以清除 PR 分支可能还不够。无论如何,任何分支(从中创建 PR)仍然会有敏感数据。

如果没有分叉并且 PR 是使用本地分支(到存储库)完成的,那么您不需要获取任何 refs/pull.
修改 PR 的源分支并强制推送它应该足以更改 Pull Request(尽管它的页面可能仍然引用现在已经过时的先前提交)。