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 <knut@ahlers.me>
This commit is contained in:
parent
3549cd2239
commit
1352f933fc
1 changed files with 9 additions and 9 deletions
18
bin/git-ps
18
bin/git-ps
|
@ -10,13 +10,13 @@ git loadkey
|
||||||
|
|
||||||
step "Fetching data from remote..."
|
step "Fetching data from remote..."
|
||||||
for remote in $(git remote -v | awk '{print $1}' | sort | uniq); do
|
for remote in $(git remote -v | awk '{print $1}' | sort | uniq); do
|
||||||
step "+++ Remote: '${remote}'"
|
step "+++ Remote: '${remote}'"
|
||||||
git fetch -p ${remote} --tags
|
git fetch -p ${remote} --tags
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ -z ${jump_branch} ]] || {
|
[[ -z ${jump_branch} ]] || {
|
||||||
step "Switching to branch ${jump_branch}"
|
step "Switching to branch ${jump_branch}"
|
||||||
git switch "${jump_branch}"
|
git switch "${jump_branch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
step "Rebasing branch / updating submodules..."
|
step "Rebasing branch / updating submodules..."
|
||||||
|
@ -24,13 +24,13 @@ git pull --rebase && git submodule update --init --recursive
|
||||||
|
|
||||||
step "Cleaning local branches..."
|
step "Cleaning local branches..."
|
||||||
for branch in $(git branch --merged | grep -v '^*'); do
|
for branch in $(git branch --merged | grep -v '^*'); do
|
||||||
# Do not delete master as the main branch
|
# Do not delete master as the main branch
|
||||||
if (test "${branch}" != "master"); then
|
if ! [[ $branch =~ (develop|main|master) ]]; then
|
||||||
git branch -d ${branch}
|
git branch -d ${branch}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
step "Removing local branches where remote branch is gone..."
|
step "Removing local branches where remote branch is gone..."
|
||||||
if (git branch -vv | grep -q ': gone]'); then
|
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
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue