git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

git-delete-branch shouldn't assume origin

Open bturrubiates opened this issue 9 years ago • 3 comments

A lot of these extra commands don't have any help text and the only way to figure out what they're doing is by looking at the source. If I run git delete-branch and want it to delete on the remote, it's because the local branch is set up to track it or I've manually specified it. The behavior of assuming origin if there is no tracking branch seems like an unintuitive default. I would expect it to give an error because the local branch isn't set up to track a remote branch, or because the remote isn't specified.

I have a similar complaint about create-branch which seems to assume origin by default.

I'll propose a fix for delete-branch at least:

  • Add a new optional argument which is the remote to delete from. This could optionally also have syntax to specify a remote branch name in case it doesn't have the same name.
  • Error if delete-branch is called without specifying a remote and no upstream remote is configured.
  • Add some help text.

If it's preferred that delete-branch also work for deleting local branches only, then a return value / warning can be setup to indicate that possibly a remote was meant to be deleted but one couldn't safely be found.

Thoughts?

bturrubiates avatar Mar 06 '16 01:03 bturrubiates

SGTM

hemanth avatar Mar 06 '16 11:03 hemanth

Cool, I can submit a PR sometime soon.

bturrubiates avatar Mar 06 '16 22:03 bturrubiates

:+1:

hemanth avatar Mar 07 '16 12:03 hemanth