Created
February 18, 2020 19:54
-
-
Save 11808s8/f1c590e5bf1f7085f013d2575cfb10b8 to your computer and use it in GitHub Desktop.
Script to automatically run git update for a specified folder.
This file contains hidden or 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
| #!/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