Skip to content

Instantly share code, notes, and snippets.

@meleu
Created September 3, 2021 23:46
Show Gist options
  • Save meleu/07f686417fde7508064db1f4d97d55eb to your computer and use it in GitHub Desktop.
Save meleu/07f686417fde7508064db1f4d97d55eb to your computer and use it in GitHub Desktop.
script criado para sincronizar com o repositório remoto
#!/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