git-delete-branch shouldn't assume origin
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 18.1k
- Forks
- 1.2k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 1
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the git-delete-branch command and compare its behavior with create-branch, including how each chooses a remote. Review the existing command help conventions. Done means delete-branch no longer silently assumes origin, supports an explicitly specified remote or upstream, and explains missing remote information; the issue also raises whether local-only deletion should be supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, shell
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100