Skip to content

Instantly share code, notes, and snippets.

@ironprice91
Last active January 27, 2016 16:15
Show Gist options
  • Select an option

  • Save ironprice91/eb492dd7dfbdbbca9d46 to your computer and use it in GitHub Desktop.

Select an option

Save ironprice91/eb492dd7dfbdbbca9d46 to your computer and use it in GitHub Desktop.
opendiff FN static files
#!/bin/bash
function static_opendiff {
undgrn='\e[4;32m'
txtred='\e[0;31m'
Color_Off='\e[0m'
static_repo=`pwd`
string_replace="backups/static-repo-copy"
if [[ ${static_repo} != *"/www/static/static-repo/"* ]]
then
echo "${txtred}NOT A STATIC REPO... EXITING${Color_Off}\n Run ww to go to static repo"
return 1
fi
echo "${undgrn} Updating static repo${Color_Off}\n"
(cd /www/static/static-repo && git merge-up)
echo "${undgrn} Updating static repo COPY${Color_Off}\n"
if [ -z "$1" ]; then
(cd /www/backups/static-repo-copy/ && git merge-up)
else
(cd /www/backups/static-repo-copy/ && git co $1 && git merge-up)
fi
static_copy=$(echo ${static_repo} | sed "s|static/static-repo|${string_replace}|")
echo "\n ${txtred}DIFFING${Color_Off} ${static_repo} ${txtred}with${Color_Off} ${static_copy}"
opendiff ${static_repo} ${static_copy}
}
alias opd=static_opendiff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment