request to squash commits if the PR has multiple

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
Igor Mandrigin 2019-04-16 09:33:21 +02:00
parent 89566a883d
commit d905aa7fa4
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
1 changed files with 8 additions and 0 deletions

View File

@ -104,6 +104,13 @@ check_is_pr_single_commit() {
fi fi
} }
request_to_squash() {
if [[ $(git rev-list $BRANCH..$PR_LOCAL_BRANCH | wc -l) -gt 1 ]] ;then
confirm "PR has multiple commits, do interactive rebase?"
git rebase -i $BRANCH
fi
}
confirm_pr() { confirm_pr() {
git log -p $BRANCH..$PR_LOCAL_BRANCH git log -p $BRANCH..$PR_LOCAL_BRANCH
confirm "Do you like this PR?" confirm "Do you like this PR?"
@ -156,6 +163,7 @@ EOF
fetch_pr fetch_pr
refresh_base_branch refresh_base_branch
rebase_pr rebase_pr
request_to_squash
check_is_pr_single_commit check_is_pr_single_commit
confirm_pr confirm_pr
sign_pr sign_pr