Created
February 1, 2019 00:36
-
-
Save YannickFricke/b81027c18c7afacbb1e243d910b1707f to your computer and use it in GitHub Desktop.
Git auto push branch
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
#!/bin/bash | |
while [[ true ]]; do | |
CURRENT_DATE=$(date "+%d.%m.%Y %H:%M:%S") | |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
clear | |
echo "$CURRENT_DATE Checking for branch: $CURRENT_BRANCH" | |
if [[ $(git fetch -q origin $CURRENT_BRANCH && git log --oneline $CURRENT_BRANCH...origin/$CURRENT_BRANCH | wc -l) -gt 0 ]]; then | |
git push -q -u origin $CURRENT_BRANCH > /dev/null | |
echo "Updated remote repository! \\o/" | |
else | |
echo "Nothing to do! \\o/" | |
fi | |
sleep -c 30 > /dev/null | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment