akonwi/git-plus

[REQUEST] Add command to delete local and remote branches at the same time

Opened this issue · 4 comments

I think it would be nice if there were a single command to delete both a local branch as well as any remote tracked branches. My last Git GUI client, SmartGit, included this as a checkbox option when deleting a local branch.

delete local and remote branches

I think the following would work, added right after the existing delete-local-branch and delete-remote-branch in gitplus.js

"git-plus:delete-local-and-remote-branch": () => {
  git.getRepo().then(repo => GitDeleteBranch(repo))
    .then(repo => GitDeleteBranch(repo, { remote: true }));
},

I understand that this could potentially be done with a Custom Command, but I think that there's enough value there that it would worthwhile to include in the full repo.

Yep this is a great idea. Could you open up a PR and add the command to lib/git-plus-commands.coffee too? Also, how about having the label be "Delete Branch (Local and Remote)"?

Then we can take it a step further later and prompt about deleting the remote branch if there is one while deleting a local branch

I like that idea. However, as far as I understand, the label is derived from the "slug" (or whatever you'd call it). How would we be able to generate the parentheses in the label from something like delete-branch-local-and-remote?

The CommandRegistry::add method has a couple signatures. What you'll do is similar to the Fetch All command

PR #794 opened.