在尝试优化 GitHub 托管的存储库时,我需要重写哪些参考文献?
Which refs, do I need to rewrite when trying to optimize a GitHub-hosted repository?
背景
我们有一个 GitHub 存储库,其存储库大小相当大,因为我们历史上有几个超过 20mb 的框架二进制文件。这会严重影响 CI 次,因为我们使用的是托管 CI,它会为每个作业获取存储库的新克隆。
为了改进这一点,我想重写历史并将大文件移动到 Git LFS。
问题
我正在尝试使用 git lfs migrate import
来达到这个目的。
作为准备步骤,我在本地跟踪了所有远程分支,因此 --everything
真的要重写所有内容,团队中的其他开发人员不必注意它,但可以获得一个全新的克隆。
当我重写 GitHub 托管的存储库的历史时,我是否需要重写并强制推送引用 GitHub 似乎用来跟踪拉取请求(refs/pull/*
) 还有吗?
git lfs migrate import
据我所知还没有包括那些。
Do I need to rewrite and force push the references GitHub seems to be using to keep track of pull requests (refs/pull/*) as well?
如果您确实需要,这将是一个问题,因为这些引用是 read-only according to Github's documentation:
The remote refs/pull/ namespace is read-only. If you try to push any commits there, you'll see this error:
! [remote rejected] HEAD -> refs/pull/1/head (deny updating a hidden ref)
error: failed to push some refs to 'git@github.local:USERNAME/REPOSITORY.git'
幸运的是,这不是问题,因为任何推送到 Pull Request 要求合并的原始分支都会 update the Pull Request:
Once you've created a pull request, you can push commits from your topic branch to add them to your existing pull request. These commits will appear in chronological order within your pull request and the changes will be visible in the "Files changed" tab.
虽然该文档中没有明确说明,但这包括强制推送到分支 - Github 将检测到分支已指向新提交,并使用新版本更新合并请求。
背景
我们有一个 GitHub 存储库,其存储库大小相当大,因为我们历史上有几个超过 20mb 的框架二进制文件。这会严重影响 CI 次,因为我们使用的是托管 CI,它会为每个作业获取存储库的新克隆。
为了改进这一点,我想重写历史并将大文件移动到 Git LFS。
问题
我正在尝试使用 git lfs migrate import
来达到这个目的。
作为准备步骤,我在本地跟踪了所有远程分支,因此 --everything
真的要重写所有内容,团队中的其他开发人员不必注意它,但可以获得一个全新的克隆。
当我重写 GitHub 托管的存储库的历史时,我是否需要重写并强制推送引用 GitHub 似乎用来跟踪拉取请求(refs/pull/*
) 还有吗?
git lfs migrate import
据我所知还没有包括那些。
Do I need to rewrite and force push the references GitHub seems to be using to keep track of pull requests (refs/pull/*) as well?
如果您确实需要,这将是一个问题,因为这些引用是 read-only according to Github's documentation:
The remote refs/pull/ namespace is read-only. If you try to push any commits there, you'll see this error:
! [remote rejected] HEAD -> refs/pull/1/head (deny updating a hidden ref) error: failed to push some refs to 'git@github.local:USERNAME/REPOSITORY.git'
幸运的是,这不是问题,因为任何推送到 Pull Request 要求合并的原始分支都会 update the Pull Request:
Once you've created a pull request, you can push commits from your topic branch to add them to your existing pull request. These commits will appear in chronological order within your pull request and the changes will be visible in the "Files changed" tab.
虽然该文档中没有明确说明,但这包括强制推送到分支 - Github 将检测到分支已指向新提交,并使用新版本更新合并请求。