Last active
January 30, 2019 18:13
-
-
Save codeif/14d868d5b0197fb80f95542908b6ff1d to your computer and use it in GitHub Desktop.
git 自动 commit and push
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
echo "crreunt branch is $CURRENT_BRANCH" | |
if [[ $CURRENT_BRANCH =~ ^[0-9]{2}-[0-9]{4}$ ]]; then | |
ST=$(git st) | |
if [[ $ST != *"nothing to commit"* ]]; then | |
echo "commit and push" | |
git ci -am "0" | |
git push | |
echo "finish push" | |
else | |
echo "no operation" | |
fi | |
else | |
echo "no operation2" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment