V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
coolair
V2EX  ›  问与答

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

  •  
  •   coolair · 2022-05-12 11:11:55 +08:00 · 2431 次点击
    这是一个创建于 686 天前的主题,其中的信息可能已经有所发展或是发生改变。
    几年前出于兴趣 fork 一个项目,然后提交了一个 pull request ,但是一直没有合并。

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

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

    现在已经删除了原来 fork 的项目,新建了 repo 开发,实在是迫于公司压力,有没有办法删除这个 pull request 呢?
    13 条回复    2022-05-13 20:39:05 +08:00
    villivateur
        1
    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 [email protected]
    UPDATE: Currently Github requires support requests to be created here: https://support.github.com/contact

    也就是说,除非你违反 Github 规则,或者严重侵犯你的权益,才可以联系 Github 删除
    Immortan
        2
    Immortan  
       2022-05-12 11:28:04 +08:00
    你那个 pull request 对应的分支删掉就好了吧。或者把新提交 force push 掉。
    coolair
        3
    coolair  
    OP
       2022-05-12 11:31:14 +08:00
    @Immortan 删掉分支没用吧,而且我那个仓库已经删了,不能再 force push 了。
    @villivateur 这个我也看了,所以,我都没联系 support 删除。
    stevenshuang
        4
    stevenshuang  
       2022-05-12 12:24:21 +08:00 via iPhone
    直接通过新的分支提交不可以吗?通过新分支提 PR
    learningman
        5
    learningman  
       2022-05-12 12:46:06 +08:00 via Android
    你不删 fork ,force push 可解,现在的话没救了
    SoloCompany
        6
    SoloCompany  
       2022-05-12 12:58:33 +08:00 via iPhone
    找到旧的 commit ,force push 上去,然后删除分支或 fork
    KouShuiYu
        7
    KouShuiYu  
       2022-05-12 13:55:43 +08:00
    保留现在的代码,检出之前的代码,然后复制粘贴
    coolair
        8
    coolair  
    OP
       2022-05-12 14:01:23 +08:00
    @SoloCompany 已经不行了,旧的仓库已经删了。
    paopjian
        9
    paopjian  
       2022-05-12 16:03:41 +08:00
    没看懂,是代码泄密了吗?
    AmberMmoe
        10
    AmberMmoe  
       2022-05-12 20:10:05 +08:00
    @SoloCompany push 了人家如果不给合呢
    SoloCompany
        11
    SoloCompany  
       2022-05-12 20:47:41 +08:00
    如果 fork 的 repo 或分支已经删除了就不可恢复了, force push 的目的是恢复 PR 状态, 至于上游是否 accept 那是另一个无法控制的事情, 先恢复分支再删除 (而不是已经添加了很多新 commit 的状态) 的好处就是再次打开 PR (可能因为删除分支或 repo 已经自动关闭了) 查看的时候, 能看到正确的 commit
    lonewolfakela
        12
    lonewolfakela  
       2022-05-13 11:49:32 +08:00
    如果真的有啥敏感信息的话应该可以直接投诉吧……
    ysc3839
        13
    ysc3839  
       2022-05-13 20:39:05 +08:00 via Android
    冷知识:GitHub 的 pull request 请求的是一整个分支,所以后续对该分支的操作都属于 pull request 。有错误的 commit 也可以用 force push 覆盖掉,不需要重新开新的 pull request 。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1038 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:28 · PVG 06:28 · LAX 15:28 · JFK 18:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.