Skip to content

Instantly share code, notes, and snippets.

@11808s8
Created February 18, 2020 19:54
Show Gist options
  • Select an option

  • Save 11808s8/f1c590e5bf1f7085f013d2575cfb10b8 to your computer and use it in GitHub Desktop.

Select an option

Save 11808s8/f1c590e5bf1f7085f013d2575cfb10b8 to your computer and use it in GitHub Desktop.
Script to automatically run git update for a specified folder.
#!/bin/bash
#Script to update a local GIT repo in case it isn't updated.
#
# Version 1.0.0
# author: Adriano Gomes da Silva <[email protected]>
#
usage() {
cat << EOM
Usage:
$(basename $0) PROJECT_PATH
EOM
}
if [ -z "$1" ] ||
[ "$1" == "-h" ] ||
[ "$1" == "--help" ]; then
usage
exit 0
fi
_projectfolder="${1}"
echo "Is your GIT REPO up to date?"
read UPDATED
if
[ "$UPDATED" == "n" ] ||
[ "$UPDATED" == "não" ] ||
[ "$UPDATED" == "nao" ] ||
[ "$UPDATED" == "no" ]; then
cd $_projectfolder
git pull
echo "Local repo succesfully updated!"
else
echo "Ok! I trust you."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment