Skip to content

Instantly share code, notes, and snippets.

@helderberto
Created August 25, 2022 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helderberto/319cee17ff4db5caf5b7d11255be9f07 to your computer and use it in GitHub Desktop.
Save helderberto/319cee17ff4db5caf5b7d11255be9f07 to your computer and use it in GitHub Desktop.
Git Sync
#!/usr/bin/env bash
org_head=$(git rev-parse HEAD)
printf "Deploying updates to GitHub...\033[0m\n"
printf "\033[0;32mDeploying commit $org_head of '🔒 vaults' \n\033[0m"
## Commit and push
if [[ `git status --porcelain` ]]; then
git add .
git commit -m "Automatic sync: $(date)
This is a commit of '$org_head'
Respository: github.com/helderberto/<REPOSITORY_NAME>"
git pull --rebase
else
printf "No changes detected.\n"
fi
git push origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment