feat: gbda flag to delete "gone" branches #114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've found that the existing
git cherrymethod of detecting branches that have been squash-merged doesn't always work.I'm not entirely sure what causes this - I think it might have to do with when another contributor has pushed commits to a branch, which I didn't get on my local machine before the branch was squash-merged and then deleted on the remote.
I have found that these branches will show up with the
[gone]tag in the remote status field.This PR adds a
--gone/-gflag that will include these branches for deletion bygbda. It is not enabled by default since there are some legitimate reasons for wanting to avoid these being deleted from the local machine, such as another user deleting a branch from a remote when the local user wasn't ready to have it be deleted.This also adds a helper function
__git.delete_branchesto delete one or more branches from a list of args, rather than rely onxargsto perform this task.Note that a branch will not show up as
[gone]if it isn't already tracking a remote.