hub
hub copied to clipboard
Sync branch deletions after a squash merge
This is my thought on a possible solution to https://github.com/github/hub/issues/1359.
It provides a --delete-all
option to the sync command that will attempt to delete all branches that were deleted on the remote, even those that do not appear merged. This will let us delete branches that were merged through a squash commit. By itself, the option prompts for confirmation on every branch similar to the delete
command with the same override option --yes
that will confirm all branches. I'm open to suggestions on better naming for that option; I'm not a big fan of it but haven't thought of anything better.
This also refactors the confirmation logic into the utils
in order to allow sharing the same approach across both commands. Because in my opinion the (yes/N)
piece of the prompt really belongs with the confirmation itself rather than the caller prompt, the order of the output switched slightly in the delete
command and its test.
Side note: I'm not a Go developer so please feel free to be pedantic with any comments or suggestions here.
Please let me know if I can provide any more context. Like I said in the description, I don't particularly like the --delete-all
option name either, so if you have an idea for that I would love to hear it.
--squashed
or --include-squashed
might make sense
@jeffg-hpe I thought about something specific to squashed, but technically this deletes all branches that don't look merged, not only those that were squashed, so I believe it would also include all branches deleted on the remote that really weren't merged too. That's why I went with "all," since it is deleting all of them to match the remote.
So maybe --delete-stray
? Inspired by git-trim.