git-smart-checkout icon indicating copy to clipboard operation
git-smart-checkout copied to clipboard

Add more git smart features

Open cszczepaniak opened this issue 2 years ago • 1 comments

This is a nice tool. I wonder what you'd think about extending it to include more git features? The top one I can think of right now would be git-smart-delete:

  • Populate the same initial list of branches as git-smart-checkout
  • Instead of a fuzzy matcher, I think you'd want something like prefix matching to be able to delete multiple branches at once, or the option to choose different matchers
  • Confirm which branches are being deleted; maybe warn for ones that aren't merged yet or don't delete those by default

I know you can just do `git branch --merged | grep -Ev "^*|main|master" | xargs git branch -d", but the more helpful UI of smart-checkout would make me feel better about cleaning up my branches, so I think this could be a good addition.

cszczepaniak avatar Jan 16 '22 22:01 cszczepaniak

Sounds good to me 👍 I'll add it to the backlog of ideas.

One way of implementing this would be to combine the search functionality with a multi select prompt. You would select needed branches by pressing a key (or maybe 2 keys simultaneously to avoid clashes with the search typing) and then press Enter to batch delete them all. The multi select would look something like this:

https://user-images.githubusercontent.com/27342306/149739180-f28b56ca-1b5b-4dd0-aa5f-abbc68618a99.mov

For those with a lot branches a solution would be to add a shortcut to select all branches matched against the search result

craciuncezar avatar Jan 17 '22 09:01 craciuncezar