lazygit
lazygit copied to clipboard
Add option to delete remote branch when deleting local branch
Is your feature request related to a problem? Please describe. Add option to delete remote branch when deleting local branch
Describe the solution you'd like After confirming the deletion of a local branch, off the user the ability to delete the remote branch
Describe alternatives you've considered Manually deleting both the local and remote branch
Additional context Add any other context or screenshots about the feature request here.
To quote Jesse:
This could also be a good candidate for a pre-set custom command. See https://github.com/jesseduffield/lazygit/wiki/Custom-Commands-Compendium
It's much easier to implement features if a user has created a custom command for it first, because it's clearer what the expected behaviour is.
You could have something like this to delete the remote branch, and then delete the local one as usual:
- key: 'D'
command: 'git push {{ .SelectedLocalBranch.UpstreamRemote }} --delete {{ .SelectedLocalBranch.UpstreamBranch }}'
context: 'localBranches'
stream: true
It is a few keystrokes extra, but hey.
If you really want to delete both at once, then this should work as well:
- key: 'D'
command: >-
git push {{ .SelectedLocalBranch.UpstreamRemote }} --delete {{ .SelectedLocalBranch.UpstreamBranch }} &&
git branch --delete {{ .SelectedLocalBranch.Name }}
context: 'localBranches'
stream: true