Skip to content

Instantly share code, notes, and snippets.

@phcostabh
Created December 27, 2013 13:46
Show Gist options
  • Select an option

  • Save phcostabh/8147081 to your computer and use it in GitHub Desktop.

Select an option

Save phcostabh/8147081 to your computer and use it in GitHub Desktop.
#!/bin/bash
branch=$(git rev-parse --abbrev-ref $1)
YELLOW='\e[0;33m'
NO_COLOR='\e[0m' #disable any colors
success () {
echo
echo -e "${YELLOW}**** $1${NO_COLOR}"
echo
}
success "Pulling changes into Live [Hub's post-update hook]"
cd /home/desenvolvedores/philippe.costa/public_html/Letras || exit
unset GIT_DIR
if [[ $branch =~ 'refs/heads' ]]; then
branch=${branch##*/}
success "Deleting branch $branch"
git checkout -f master
git branch -D $branch
exit
fi
git reset --hard HEAD
success "Checking out branch $branch"
git checkout -b $branch &> /dev/null || git checkout $branch
success "Updating branch $branch"
git pull --strategy=recursive -X theirs hub $branch
exec git-update-server-info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment