Skip to content

Instantly share code, notes, and snippets.

@mannieschumpert
Last active December 18, 2015 22:29
Show Gist options
  • Save mannieschumpert/5855129 to your computer and use it in GitHub Desktop.
Save mannieschumpert/5855129 to your computer and use it in GitHub Desktop.
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-hos…
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
}
@mannieschumpert
Copy link
Author

Takes one parameter: the theme folder.
Example: devinit theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment