Skip to content

Instantly share code, notes, and snippets.

@codeif
Last active January 30, 2019 18:13
Show Gist options
  • Save codeif/14d868d5b0197fb80f95542908b6ff1d to your computer and use it in GitHub Desktop.
Save codeif/14d868d5b0197fb80f95542908b6ff1d to your computer and use it in GitHub Desktop.
git 自动 commit and push
#!/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