Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
This repository was archived by the owner on Nov 18, 2021. It is now read-only.

Auto-delete branch on pull request merge #1121

Closed

Description

@stuartpb

It would be nice if we could have a checkbox / button or something for pull requests to make it so, when the pull request is merged, rather than having to revisit the PR and manually click the "Delete branch" button, the branch for the pull request would be deleted automatically. This is one of the features @jessfraz was just tweeting about running out of GitHub API calls to implement for herself: https://twitter.com/jessfraz/status/930154061869002752

Just sent this suggestion to GitHub Support.

Activity

  1. stuartpb commented on Nov 13, 2017

    @stuartpb
    Author

    Wow, that was fast, looks like they've got a template response email for feature requests:

    Hi there,

    Thanks for reaching out! I'd be happy to pass this along to the team to consider as a feature request. I can't promise if or when it will be implemented, but your suggestion is definitely in the right hands!

    Regards,
    Laura
    @lecoursen
    GitHub Support

  2. pedro93 commented on Nov 13, 2017

    @pedro93

    Amazing!

  3. davyengone commented on Feb 20, 2018

    @davyengone

    Is this feature request still pending? That would be great to have it

  4. martinbonnin commented on Feb 20, 2018

    @martinbonnin

    For what it's worth, I worked around this issue by writing a small script that auto-deletes merged branches every night. Not ideal but works.

  5. jimbol commented on Feb 27, 2018

    @jimbol

    Would you be willing to share that with us @martinbonnin? I'd star that repo

  6. ericanderson commented on Mar 22, 2018

    @ericanderson

    This just annoyed me recently enough that I wrote a script. I intend to produce other useful things for working against git/gh inside it and PRs are welcome. Just ran it on internal instance to success: https://github.com/ericanderson/ghouls

  7. treps commented on May 9, 2018

    @treps

    Have there been any updates on whether this is going to be a thing anytime soon?

  8. tonypiazza commented on May 9, 2018

    @tonypiazza

    @lecoursen This would be very helpful. Can you give us an update on this?

  9. monperrus commented on May 11, 2018

    @monperrus

    I guess that this can be implemented as a webhook. Has anybody ever done so?

  10. sparky005 commented on Jun 6, 2018

    @sparky005

    +1 for this feature.

  11. tansaku commented on Jun 8, 2018

    @tansaku

    we'd love it too!

  12. renoirtech commented on Jun 14, 2018

    @renoirtech
  13. 15 remaining items

  14. teeberg commented on Dec 11, 2018

    @teeberg
  15. sindresorhus commented on Dec 12, 2018

    @sindresorhus

    PR welcome for this on Refined GitHub: refined-github/refined-github#1024

  16. amueller commented on Jul 16, 2019

    @amueller

    there is a button right after the merge button. That seems like enough, right?

  17. clarkbw commented on Jul 31, 2019

    @clarkbw
    Collaborator
  18. mgoddard27 commented on Aug 2, 2019

    @mgoddard27

    Will the 'auto-delete branches' feature be available on GitHub Enterprise as well, anytime soon?

  19. SvanBoxel commented on Aug 5, 2019

    @SvanBoxel

    @mgoddard27 Assuming you mean GitHub Enterprise Server; yes. Normally GitHub ships features to Enterprise Server after they are battle-tested on GitHub.com. This could take a couple of months because of the quarterly release cadence for GitHub Enterprise Server.

  20. testworksau commented on Sep 3, 2019

    @testworksau

    @clarkbw any idea when an API to turn this setting on / off might arrive? It's not listed here:
    https://developer.github.com/v3/repos/#edit

    On another note - a repository maintainer has access to enable / disable the merge button to allow merge commits / squash merging / rebase merging in the GitHub UI, but does not have the ability to see the new Automatically delete head branches setting. Was this intentional?

  21. clarkbw commented on Sep 3, 2019

    @clarkbw
    Collaborator

    I don't have a timeline for the API yet, looking into it.

    On another note - a repository maintainer has access to enable / disable the merge button to allow merge commits / squash merging / rebase merging in the GitHub UI, but does not have the ability to see the new Automatically delete head branches setting. Was this intentional?

    re: the Maintainer role? I'll look into it.

  22. testworksau commented on Nov 6, 2019

    @testworksau

    @clarkbw I've found that this setting is unexpectedly being turned off on us when using the Edit repos endpoint.

    We use the https://developer.github.com/v3/repos/#edit API to configure merge strategies on our repositories. We typically send the following information (and only the following information) in the patch request:

    {
      "allow_merge_commit": false,
      "allow_squash_merge": true,
      "allow_rebase_merge": true
    }
    

    After calling the API, the Automatically delete head branches setting turns off.

  23. clarkbw commented on Nov 6, 2019

    @clarkbw
    Collaborator

    That’s not good... can you send this through support so it gets to the right people? Thx!

  24. meabed commented on Nov 10, 2019

    @meabed

    @clarkbw I've found that this setting is unexpectedly being turned off on us when using the Edit repos endpoint.

    We use the https://developer.github.com/v3/repos/#edit API to configure merge strategies on our repositories. We typically send the following information (and only the following information) in the patch request:

    {
      "allow_merge_commit": false,
      "allow_squash_merge": true,
      "allow_rebase_merge": true
    }
    

    After calling the API, the Automatically delete head branches setting turns off.

    I have exactly the same issue, @clarkbw there is no option to toggle this through the API as well.
    image

    image

    It would be great if this could be addressed :)

  25. terowz commented on Dec 16, 2019

    @terowz

    do you have any idea when this will be available in the API as well?
    or am I just missing the docs on it?

  26. testworksau commented on Feb 13, 2020

    @testworksau

    The bug has finally been fixed, and this parameter is now available through the API, as delete_branch_on_merge.

    https://developer.github.com/v3/repos/#edit

    As a bonus for those using PyGitHub, I've also raised a PR to enable this parameter to be configured, which has been merged and is available in PyGitHub 1.46

    https://github.com/PyGithub/PyGithub/releases/tag/v1.46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions