Skip to content

Instantly share code, notes, and snippets.

@shannonwells
Created July 17, 2020 16:24
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 shannonwells/9d26c3cf10bfbe199ea11bc4580e431c to your computer and use it in GitHub Desktop.
Save shannonwells/9d26c3cf10bfbe199ea11bc4580e431c to your computer and use it in GitHub Desktop.
A git update script for a nodejs project
#!/bin/bash
# emojis help instantly recognize something went wrong and where
function exit_err() { echo "❌ 💔" ; exit 1; }
set -Euo pipefail
echo "Updating your repo."
echo "☕️ Take a break - this might take a few minutes."
git stash
git co master -q
git pull origin master --ff-only -q
git fetch --prune -q
npm install || exit_err()
npm run build || exit_err()
echo "🍩 Done." # have a donut - everyone needs a donut sometimes
echo $'\a' # a beep in case you weren't paying attention
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment