Created
September 3, 2021 23:46
-
-
Save meleu/07f686417fde7508064db1f4d97d55eb to your computer and use it in GitHub Desktop.
script criado para sincronizar com o repositório remoto
This file contains 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 | |
# BUG: se por um acaso o script não concluir o push com sucesso, a próxima | |
# execução não fará o push (git status não vai pegar mudança alguma). | |
main() { | |
gitStatus="$(git status --porcelain)" | |
[[ -z "${gitStatus}" ]] && return 0 | |
git add --all \ | |
&& git commit -m "Automated sync: ${gitStatus}" \ | |
&& git pull --rebase \ | |
&& git push | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment