mannieschumpert
6/25/2013 - 1:11 AM

Bash function for initializing a WordPress theme repo and setting it up to receive push. Directories are of course specific to my workflow.

Bash function for initializing a WordPress theme repo and setting it up to receive push. Directories are of course specific to my workflow. Change as necessary. (Note: works with HostGator. I'm not sure if it works universally.) Git-specific info via @mexitek. http://www.arlocarreon.com/blog/git/push-git-repo-into-shared-hosting-account-like-hostgator/

devinit() {
  # move to dev themes
  cd public_html/dev/wp-content/themes
  # create theme directory
  mkdir ${1}
  # move into it
  cd ${1}
  #initialize git
  git init
  # configure for receiving pushes
  git config receive.denyCurrentBranch ignore
  # create and append post-receive hook
  echo "GIT_WORK_TREE=../ git checkout -f" > .git/hooks/post-receive
  # make file executable
  chmod +x .git/hooks/post-receive
  # print directory for copying to set up push from local
  pwd
}