我正在清理一个git存储库的拉请求(PR)。有一个PR是为了合并一个分支B而创建的,它后来被认为是在合并之前被废弃和删除的。因此,分支B被删除了,并且这个PR没有出现在Bitbucket的拉请求列表中。但是,如果我使用git show-ref,这个PR既在参考列表中,也在远程存储库历史中。是否有一种方法可以清除远程存储库中的PR?
master branch
|
|
| * branch B, Pull Request
| |
| /
| /
| /
|/
*
|
|添加:此PR存在于远程存储库中。我可以直接复制到本地,用git reflog expire --expire=now --all && git gc --prune=now --aggressive删除本地PR,但是不知道如何在远程存储库中删除这个PR。
我在使用BFG清理存储库历史记录时遇到了这个问题,正如讨论过的这里一样。我对远程的本地更改被拒绝了,因为引用被拒绝了(如下所示,这是关于这一主题的相关讨论)
(base) ****@*****:~/*****/abcde.git$ git push --force
Username for *****************:
Password for *****************:
Counting objects: 17811, done.
Delta compression using up to 24 threads.
Compressing objects: 100% (10604/10604), done.
Writing objects: 100% (17811/17811), 367.27 MiB | 2.16 MiB/s, done.
Total 17811 (delta 6545), reused 17811 (delta 6545)
remote: Resolving deltas: 100% (6545/6545), done.
remote: You are attempting to update refs that are reserved for Bitbucket's pull request functionality. Bitbucket manages these refs automatically, and they may not be updated by users.
remote: Rejected refs:
remote: refs/pull-requests/2/from
remote: refs/pull-requests/2/merge
remote: refs/pull-requests/5/from
remote: refs/pull-requests/5/merge
remote:更新
最后,我绕过了参考冲突问题,创建了一个新的空远程存储库,并将本地的git镜像推到了那里。
cd ~/<repo_directory/repo_name>
git remote set-url origin <bitbucket_URL>
git push --mirror发布于 2020-11-05 14:20:20
是否有一种方法可以清除远程存储库中的PR?
根据你的记录,
remote: Resolving deltas: 100% (6545/6545), done.
remote: You are attempting to update refs that are reserved for Bitbucket's pull request functionality. Bitbucket manages these refs automatically, and they may not be updated by users.
remote: Rejected refs:
remote: refs/pull-requests/2/from
remote: refs/pull-requests/2/merge
remote: refs/pull-requests/5/from
remote: refs/pull-requests/5/merge比特桶不会让你通过Git去碰那些裁判。如何将它们删除是Bitbucket支持的一个问题。有关权威背景的内容,请参见对语义的讨论。
发布于 2020-11-05 04:11:29
确保你已经删除了分支,而不仅仅是公关。如果裁判出现在您的本地,您可以运行git fetch --prune来移除不在远程上的本地推荐。您还可能希望运行git gc来删除孤儿对象,作为后续操作。
发布于 2020-12-21 22:21:34
最后,我使用以下命令解决了ref问题:
git show-ref | cut -d' ' -f2 | grep 'pull-request' | xargs -r -L1 git update-ref -d并确认清洁工作如下:
git show-refhttps://stackoverflow.com/questions/64691036
复制相似问题