git_rebase_my_shit
#!/usr/bin/env bash
branch_folder="feature"
git config --global fetch.prune true
git config --global rerere.enabled true
git config --global rerere.autoupdate true
#git reset --hard HEAD
git fetch --all
git_rebase_pull ()
{
git pull --rebase || git rebase --abort
}
git_rebase_on_dev ()
{
git rebase origin/develop || git rebase --abort
}
git_push_or_abort ()
{
git push --force || git rebase --abort
}
git_my ()
{
git checkout $1 2> /dev/null && git checkout -b mherod/$1 2> /dev/null || git checkout mherod/$1
}
git_checkout_rebase ()
{
git checkout $1 && git_rebase_pull
}
git_rebase_branch_on_dev ()
{
git_checkout_rebase $1 && git_rebase_on_dev
}
git_loop () {
git for-each-ref --format='%(refname)%(authoremail)' refs/heads/${branch_folder}
}
gradle_test () {
./gradlew test
}
git_my develop
git_main_rebase_my_shit () {
for branch in $(git_loop); do
branchName="${branch_folder}/$(echo $branch | rev | cut -d'/' -f1 | rev | cut -d'<' -f 1 )"
if git branch --no-merged origin/develop | grep " ${branchName}"; then
git_checkout_rebase $branchName
git rebase --abort &> /dev/null
if [[ $branch == *"matthew.herod"* ]]; then
git_rebase_branch_on_dev $branchName && gradle_test #&& git_push_or_abort
else
git_rebase_branch_on_dev $branchName && gradle_test
fi
fi
done
}
git_clean_the_fuck_up () {
git prune && git reflog expire --expire=now --all && git gc && git prune && git gc
}
git_main_rebase_my_shit