git-extras
git-extras copied to clipboard
delete-branch should have a -r (remote) flag like create-branch
Way to powerfull tool 😉
Like create-branch this should have a -r (remote) option instead. This way you are not able to delete a remote by accident.
Deleting is easier than creating this way.
@rvantonisse
git delete-branch
will try to get the remote via git config
:
https://github.com/tj/git-extras/blob/master/bin/git-delete-branch#L9
So if a remote is deleted by accident, it should be a bug.
Anyway, specifying remote explicitly is a good idea. Pull request is welcome!
if i only want to remove the local branch i can do just git branch -d foo-branch
, so what would be the point ?
i was about to post another bug wrt. to delete-branch
for my case, but now abstain from it having found this issue and also #638 and it got me thinking.
if you want i can move this into an own ticket or some other place where we can discuss this.
the question is: what one would one expect from delete-branch
, ie which remote, or rather what cases exists that warrant special confirmation ?
aspect: name of the branch
- i'd say, if the remote is the same name as the local, go ahead
- but what if the remote has a different name ?
- what if it is local ?
aspect: ahead/behind
- should we also always delete the remote if it's ahead (i guess behind is less of a problem) of the local branch ?
to me, in all those iffy case i would say delete-branch
should either
- ask the user how to proceed OR
- skip OR
- only proceed if the flag like
-f|--force
is given
I think we should keep the original behavior unchanged. Since you think deleting the remote upstream may cause problem, I think we can ask the user whether to continue, and provide a flag to skip the prompt.
I think we should keep the original behavior unchanged. Since you think deleting the remote upstream may cause problem, I think we can ask the user whether to continue, and provide a flag to skip the prompt.
I agree to keep the original behavior unchanged cause the delete-branch
behavior should be simple, but try to provide a flag like git-extra.delete-branch.skip_prompt
confuses me a little cause it cannot clarify the git-extra.skip_prompt
if exists.