Skip to content

Instantly share code, notes, and snippets.

@FreeWall
Last active July 18, 2019 19:03
Show Gist options
  • Save FreeWall/21a32a096b6dc1c8b1a5e152348b86e0 to your computer and use it in GitHub Desktop.
Save FreeWall/21a32a096b6dc1c8b1a5e152348b86e0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# exit when any command fails
set -e
COLOR_GREEN="\033[0;32m"
DEVELOPER=$(whoami)
cd "/var/www/$DEVELOPER.tmp123.cz/web/"
clear
echo "Updating repository starts ..."
if [ -L media/catalog ]
then
unlink media/catalog
fi
git fetch
git reset --hard
branch=$1
if [ -n "$branch" ]
then
git checkout $branch
else
git checkout master
fi
git checkout -- .
git clean -fd .
git pull
rm -rf media/catalog
ln -s $(pwd)/../../vyvojar1.tmp123.cz/web/media/catalog media/catalog
git status
echo -e "$COLOR_GREEN"
echo "DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment