From 1352f933fc6322b85a3d5395c0cdcedd3503f671 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 20 Jul 2022 16:38:46 +0200 Subject: [PATCH] Do not remove develop / main branches - `develop` is the default for git-flow - `main` the "new default" for git in general Signed-off-by: Knut Ahlers --- bin/git-ps | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/git-ps b/bin/git-ps index e7c1ac6..5a30646 100755 --- a/bin/git-ps +++ b/bin/git-ps @@ -10,13 +10,13 @@ git loadkey step "Fetching data from remote..." for remote in $(git remote -v | awk '{print $1}' | sort | uniq); do - step "+++ Remote: '${remote}'" - git fetch -p ${remote} --tags + step "+++ Remote: '${remote}'" + git fetch -p ${remote} --tags done [[ -z ${jump_branch} ]] || { - step "Switching to branch ${jump_branch}" - git switch "${jump_branch}" + step "Switching to branch ${jump_branch}" + git switch "${jump_branch}" } step "Rebasing branch / updating submodules..." @@ -24,13 +24,13 @@ git pull --rebase && git submodule update --init --recursive step "Cleaning local branches..." for branch in $(git branch --merged | grep -v '^*'); do - # Do not delete master as the main branch - if (test "${branch}" != "master"); then - git branch -d ${branch} - fi + # Do not delete master as the main branch + if ! [[ $branch =~ (develop|main|master) ]]; then + git branch -d ${branch} + fi done step "Removing local branches where remote branch is gone..." if (git branch -vv | grep -q ': gone]'); then - git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D + git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D fi