[.zshrc] Add alias for git "dirty" squash

This commit is contained in:
Daniel Carrillo 2022-07-08 19:29:48 +02:00
parent aad77aa8d6
commit e5ca1076d4
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
1 changed files with 16 additions and 0 deletions

16
.zshrc
View File

@ -73,6 +73,22 @@ kexec () {
[ -n "$cid" ] && kubectl exec -ti "$cid" -- "${cmd[@]}"
}
# "dirty" squash before merge
git_squash () {
if [ -z $2 ]; then
echo "Usage: $0 <base branch> \"commit message\""
return 1
fi
local bbranch=$1
local message=$2
local cbranch=$(git branch --show-current)
git reset $(git merge-base $bbranch $cbranch)
git add -A
git commit -m "$message"
}
##### tilix #####
if [ $TILIX_ID ] || [ $VTE_VERSION ] ; then