#!/bin/bash
Dir=$1
ForkName=$2
cd $Dir
current_branch=$(git branch | awk '$1 == “*”{print $2}')
while true do
read -r -p "The currrent branch is:$current_branch,continue?[Y/n] " input case $input in [yY][eE][sS]|[yY]) break; ;; [nN][oO]|[nN]) echo "Done" exit 1 ;; *) echo "Please enter a correct option." ;; esac
done
git diff
git status
while true do
read -r -p "The changes to be committed,continue?[Y/n] " input case $input in [yY][eE][sS]|[yY]) break; ;; [nN][oO]|[nN]) echo "Done" exit 1 ;; *) echo "Please enter a correct option." ;; esac
done
Commit=“”
while [[ $Commit == “” ]] do
read -r -p "Commit message:" input Commit=$input
done
echo 'Performing commit.'
git add .
git commit -m $Commit
echo 'Performing push.'
result=$(git remote -v | grep 'gitlab')
if [[ “$result” != “” ]] then
git push origin $current_branch:$current_branch
else
git push origin head:refs/for/master echo "Please visit the gerrit to continue operation!"
fi cd ..