coolair
V2EX  ›  问与答

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

  •  
  •   coolair · May 12, 2022 · 3552 views
    This topic created in 1487 days ago, the information mentioned may be changed or developed.
    几年前出于兴趣 fork 一个项目,然后提交了一个 pull request ,但是一直没有合并。

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

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

    现在已经删除了原来 fork 的项目,新建了 repo 开发,实在是迫于公司压力,有没有办法删除这个 pull request 呢?
    13 replies    2022-05-13 20:39:05 +08:00
    villivateur
        1
    villivateur  
       May 12, 2022
    直接贴:

    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  
       May 12, 2022
    你那个 pull request 对应的分支删掉就好了吧。或者把新提交 force push 掉。
    coolair
        3
    coolair  
    OP
       May 12, 2022
    @Immortan 删掉分支没用吧,而且我那个仓库已经删了,不能再 force push 了。
    @villivateur 这个我也看了,所以,我都没联系 support 删除。
    stevenshuang
        4
    stevenshuang  
       May 12, 2022 via iPhone
    直接通过新的分支提交不可以吗?通过新分支提 PR
    learningman
        5
    learningman  
       May 12, 2022 via Android
    你不删 fork ,force push 可解,现在的话没救了
    SoloCompany
        6
    SoloCompany  
       May 12, 2022 via iPhone
    找到旧的 commit ,force push 上去,然后删除分支或 fork
    KouShuiYu
        7
    KouShuiYu  
       May 12, 2022
    保留现在的代码,检出之前的代码,然后复制粘贴
    coolair
        8
    coolair  
    OP
       May 12, 2022
    @SoloCompany 已经不行了,旧的仓库已经删了。
    paopjian
        9
    paopjian  
       May 12, 2022
    没看懂,是代码泄密了吗?
    AmberMmoe
        10
    AmberMmoe  
       May 12, 2022
    @SoloCompany push 了人家如果不给合呢
    SoloCompany
        11
    SoloCompany  
       May 12, 2022
    如果 fork 的 repo 或分支已经删除了就不可恢复了, force push 的目的是恢复 PR 状态, 至于上游是否 accept 那是另一个无法控制的事情, 先恢复分支再删除 (而不是已经添加了很多新 commit 的状态) 的好处就是再次打开 PR (可能因为删除分支或 repo 已经自动关闭了) 查看的时候, 能看到正确的 commit
    lonewolfakela
        12
    lonewolfakela  
       May 13, 2022
    如果真的有啥敏感信息的话应该可以直接投诉吧……
    ysc3839
        13
    ysc3839  
       May 13, 2022 via Android
    冷知识:GitHub 的 pull request 请求的是一整个分支,所以后续对该分支的操作都属于 pull request 。有错误的 commit 也可以用 force push 覆盖掉,不需要重新开新的 pull request 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2909 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 06:23 · PVG 14:23 · LAX 23:23 · JFK 02:23
    ♥ Do have faith in what you're doing.