有办法删除 GitHub 上已经被 closed(未被 merge)的 pull request 吗?

2022-05-12 11:11:55 +08:00
 coolair
几年前出于兴趣 fork 一个项目,然后提交了一个 pull request ,但是一直没有合并。

最近,公司项目需要用到类似的东西,觉得这个项目比较合适,而且 License 是 MIT ,就在之前 fork 的基础上开发了。

后面发现提交的 commits 自动附加到原来提交的那个 pull request 上去了。

现在已经删除了原来 fork 的项目,新建了 repo 开发,实在是迫于公司压力,有没有办法删除这个 pull request 呢?
2469 次点击
所在节点    问与答
13 条回复
villivateur
2022-05-12 11:20:28 +08:00
直接贴:

https://stackoverflow.com/questions/18318097/delete-a-closed-pull-request-from-github

> There is no way you can delete a pull request yourself -- you and the repo owner (and all users with push access to it) can close it, but it will remain in the log. This is part of the philosophy of not denying/hiding what happened during development.
However, if there are critical reasons for deleting it (this is mainly violation of Github Terms of Service), Github support staff will delete it for you.
Whether or not they are willing to delete your PR for you is something you can easily ask them, just drop them an email at support@github.com
UPDATE: Currently Github requires support requests to be created here: https://support.github.com/contact

也就是说,除非你违反 Github 规则,或者严重侵犯你的权益,才可以联系 Github 删除
Immortan
2022-05-12 11:28:04 +08:00
你那个 pull request 对应的分支删掉就好了吧。或者把新提交 force push 掉。
coolair
2022-05-12 11:31:14 +08:00
@Immortan 删掉分支没用吧,而且我那个仓库已经删了,不能再 force push 了。
@villivateur 这个我也看了,所以,我都没联系 support 删除。
stevenshuang
2022-05-12 12:24:21 +08:00
直接通过新的分支提交不可以吗?通过新分支提 PR
learningman
2022-05-12 12:46:06 +08:00
你不删 fork ,force push 可解,现在的话没救了
SoloCompany
2022-05-12 12:58:33 +08:00
找到旧的 commit ,force push 上去,然后删除分支或 fork
KouShuiYu
2022-05-12 13:55:43 +08:00
保留现在的代码,检出之前的代码,然后复制粘贴
coolair
2022-05-12 14:01:23 +08:00
@SoloCompany 已经不行了,旧的仓库已经删了。
paopjian
2022-05-12 16:03:41 +08:00
没看懂,是代码泄密了吗?
AmberMmoe
2022-05-12 20:10:05 +08:00
@SoloCompany push 了人家如果不给合呢
SoloCompany
2022-05-12 20:47:41 +08:00
如果 fork 的 repo 或分支已经删除了就不可恢复了, force push 的目的是恢复 PR 状态, 至于上游是否 accept 那是另一个无法控制的事情, 先恢复分支再删除 (而不是已经添加了很多新 commit 的状态) 的好处就是再次打开 PR (可能因为删除分支或 repo 已经自动关闭了) 查看的时候, 能看到正确的 commit
lonewolfakela
2022-05-13 11:49:32 +08:00
如果真的有啥敏感信息的话应该可以直接投诉吧……
ysc3839
2022-05-13 20:39:05 +08:00
冷知识:GitHub 的 pull request 请求的是一整个分支,所以后续对该分支的操作都属于 pull request 。有错误的 commit 也可以用 force push 覆盖掉,不需要重新开新的 pull request 。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/852361

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX