#!/usr/bin/env bash
if [[ $# != 1 ]]; then
echo "usage: $0 [commit id]"
exit 1
fi
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$1
exit 0
#!/usr/bin/env bash
# fetch and check commit message
# if then elif then else fi
if [[ $# != 1 ]]; then
echo "please input commit message, usage: $0 [commit_message]."
exit 1
else
foo=$1
foo_trim="$(echo -e "${foo}" | tr -d '[:space:]')"
if [[ ! ${foo_trim} || ${foo_trim} == '' ]]; then
echo "message cannot be empty, please specific commit message, your input ===>>> [${foo}]"
exit 1
fi
echo "use commit message ===>>> [$1]."
fi
# get git info
current_branch=`git symbolic-ref --short HEAD`
remote_v=`git remote -v`
echo "current branch is ===>>> [${current_branch}]."
echo "try to check if current branch has exits on remote ===>>> ${remote_v}."
# check if branch has exist on remote
branch_exits=`git ls-remote --heads ${remote_v} ${current_branch}`
echo "check result ${branch_exits}."
if [[ ! ${branch_exits} || ${branch_exits} == '' ]]; then
echo "current branch [${current_branch}] is not exists on remote."
exit 1;
fi
commit_data=`git status --porcelain`
if [[ ! ${commit_data} || ${commit_data} == '' ]]; then
echo "current branch [${current_branch}], nothing to commit, working tree clean."
exit 1;
else
echo "commit data:"
echo ${commit_data}
fi
# go push D:
git add .
git commit -m "$1"
git push
exit 0