• Skip to primary navigation
  • Skip to main content

Javier Lona

Web Developer in Texas

  • Home
  • Blog
  • Projects
  • Email
  • GitHub
  • LinkedIn
  • Twitter
  • YouTube

How to Use Git for Custom WordPress Theme Development

July 16, 2018 by Javier

Gain the ability to revert from a lousy code update or save your progress when the code works.

What’s Needed?

Make sure you have read and write permissions for your local directory where you’re developing your theme. If not, navigate to your themes folder and enter the following command:

sudo chown -R [username]:[username] .*

wp-theme-directory-command
You should now have ownership of the contents inside the themes folder:

wp-theme-directory

Introduce Git

Navigate inside your themes folder and issue the following Git commands:

git init
git add .
git commit -m "first commit"

Head to GitHub.com

Create a new repository. Name the repo the same name as your theme folder or whatever name you want. DO NOT check “Initialize this repository with a README” and DO NOT add a .gitignore.

You should see the above screen. Follow & enter the instructions in the “..or push an existing repository from the command line” into your terminal.

git remote add origin git@github.com:javierlona/bootstrap2wordpress.git
git push -u origin master

Your theme files should now appear on the remote repository.

Category iconGuide Tag iconLinux,  WordPress