summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarc Cornellà <marc@mcornella.com>2023-10-18 20:01:58 +0200
committerGitHub <noreply@github.com>2023-10-18 20:01:58 +0200
commit8152dc673b14c89dc12e816583e24532ed77e8ae (patch)
tree127d65d582fee5c631978168ff19a80e9e829add /plugins
parentb696288337618ca749369a679bd77989bd4cd47e (diff)
downloadzsh-8152dc673b14c89dc12e816583e24532ed77e8ae.tar.gz
zsh-8152dc673b14c89dc12e816583e24532ed77e8ae.tar.bz2
zsh-8152dc673b14c89dc12e816583e24532ed77e8ae.zip
fix(git): move squash-merged branch deletion from `gbda` to `gbds` function (#11991)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/git/README.md3
-rw-r--r--plugins/git/git.plugin.zsh6
2 files changed, 6 insertions, 3 deletions
diff --git a/plugins/git/README.md b/plugins/git/README.md
index a4e9f4c4a..724965302 100644
--- a/plugins/git/README.md
+++ b/plugins/git/README.md
@@ -250,7 +250,8 @@ receive further support.
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. |
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
-| `gbda` | Deletes all merged and squash-merged branches |
+| `gbda` | Deletes all merged branches |
+| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
### Work in Progress (WIP)
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index d053a7638..48937cb83 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -128,11 +128,13 @@ alias gba='git branch --all'
alias gbd='git branch --delete'
alias gbD='git branch --delete --force'
-# Copied and modified from James Roeder (jmaroeder) under MIT License
-# https://github.com/jmaroeder/plugin-git/blob/216723ef4f9e8dde399661c39c80bdf73f4076c4/functions/gbda.fish
function gbda() {
git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null
+}
+# Copied and modified from James Roeder (jmaroeder) under MIT License
+# https://github.com/jmaroeder/plugin-git/blob/216723ef4f9e8dde399661c39c80bdf73f4076c4/functions/gbda.fish
+function gbds() {
local default_branch=$(git_main_branch)
(( ! $? )) || default_branch=$(git_develop_branch)