Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ricardoseriani
Copy link
Contributor

Closes #1957

Signed-off-by: Ricardo Seriani [email protected]

Copy link
Contributor

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this and feel that it does mirror the .com experience more closely (where you have to exert a little more effort to delete a merged branch)

@vilmibm vilmibm merged commit aa72881 into cli:trunk Sep 29, 2020
@shawnkoh
Copy link

shawnkoh commented Oct 9, 2020

Can this be a setting instead? I much prefer having the default to be yes

@mislav
Copy link
Contributor

mislav commented Oct 9, 2020

@shawnkoh In general, we tend to default to what we think is the safest choice. If an accidental keystroke could lead to a branch being deleted, we'd rather that the accidental keystroke does nothing.

Currently, we want to avoid adding to many configuration options, but we will consider this in the future if it becomes a popular request.

If you prefer to always delete branches after merges on the repository level, you can go to repo settings in GitHub web (if you are a repo admin) and choose the option to auto-delete branches after PR merges.

@shawnkoh
Copy link

shawnkoh commented Oct 9, 2020

@shawnkoh In general, we tend to default to what we think is the safest choice. If an accidental keystroke could lead to a branch being deleted, we'd rather that the accidental keystroke does nothing.

Currently, we want to avoid adding to many configuration options, but we will consider this in the future if it becomes a popular request.

If you prefer to always delete branches after merges on the repository level, you can go to repo settings in GitHub web (if you are a repo admin) and choose the option to auto-delete branches after PR merges.

Good point. thank you for taking the time to respond.

i'll explore finding an alternative to automatically delete the local branch upon merge.

@OliverJAsh
Copy link

OliverJAsh commented Oct 28, 2020

Note: the docs/manual needs updating:

https://cli.github.com/manual/gh_pr_merge

By default, the head branch of the pull request will get deleted on both remote and local repositories. To retain the branch, use '--delete-branch=false'.

FLAGS
-d, --delete-branch Delete the local and remote branch after merge (default true)

^ This is no longer true. The default is now false.

I would have sent a PR but I couldn't find the repo that contains the manual? Maybe it would be a good idea to open source those if you haven't already?

@mislav
Copy link
Contributor

mislav commented Oct 28, 2020

@OliverJAsh Our docs are generated from the source code:

Merge a pull request on GitHub.
By default, the head branch of the pull request will get deleted on both remote and local repositories.
To retain the branch, use '--delete-branch=false'.

However, I do not think that the docs are outdated here. They refer to the default for the --delete-branch flag meant for scripting/automation, and the --delete-branch default is still true and needs to be explicitly flipped to false in scripts.

This PR flipped the default for the interactive prompt to guard against accidentally pressing Enter, resulting in a destructive operation.

@OliverJAsh
Copy link

Ahh okay, thanks for clarifying. I guess my next question is whether the default should be the same for --default-branch.

@mislav
Copy link
Contributor

mislav commented Oct 28, 2020

@OliverJAsh That's a good question to make. You are welcome to open an issue about it and reference #899 (comment) 🙇

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default answer to deleting branch after merge should be no

6 participants