feat(git): add clean-branches alias

This commit is contained in:
Felix Schröter 2023-05-31 16:58:38 +02:00
parent 4351cc0d54
commit 3b8224dfd2
Signed by: felschr
GPG key ID: 671E39E6744C807D

View file

@ -39,6 +39,10 @@
"!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -";
# usage: git pr <source> <PR number> (git pr origin 1010)
pr = "!sh -c 'git fetch $1 pull/$2/head:pr/$2 && git checkout pr/$2' -";
# delete branches locally that have already been merged
# usage: git clean-branches <branch> (branch to check against, defaults to main)
clean-branches = ''
!sh -c 'git branch --merged "''${1:-main}" | egrep -v "(^\*|master|main|staging|production)" | xargs git branch -d' -'';
};
};
}