The Thoughtbot dotfiles include a gitconfig which includes an alias for deleting local and remote branches. I use it all the time but it’s a real pain having to fully type out the branch name each time. I’ve tried using compdef but that just doesn’t work. I think it’s because the command is just shelling out to git maybe?
I’ve been trying to fix this on and off for months now, so any input would be awesome! This post inspired me to try again but I still can’t get it working.
Hi, Aaron… I think you could try the gbc method from this post to fill in the current branch name at the appropriate time. For example, maybe something like this could work, assuming you’re on the branch you want to delete:
There’s a PR to add auto-completion, but given some of the feedback it looks like it doesn’t work for everyone. I haven’t tried it myself, but I’m also using fish (not zsh).
Awesome thanks for that! I’ve got the git command itself returning the branches, so git delete-branch <TAB> displays the list, but now I’m trying to work out how to make my gdb zsh alias show the list too.