Hi guys wonder if there is something like a guide to use git to manage WP projects. I have always been a cowboy coder, and I need to make this shift to Git to become more standarized...how can I begin? at least i would love to have my theme in GIT to have a backup copy of it and be able to track the changes. Im the only person working on the project, but I need to prepare myself for future jobs so I want to test this GIT+WP.
How to use wordpress with Git?
Actually your question is a bit wrong, and should actually be:
How to use Git with WordPress?
As git is for controlling versions so using it depends upon you what actually you want to take under version controlling. I personally develop WordPress themes and plugins so I control versions, specific to themes and plugins only.
When developing a theme (i.e.
my-theme is the folder name), I get into it:
cd my-theme git init git add -A git commit -m "Started developing the theme"
In this way I manage all the versions of my development phase to that particular theme. But in the meantime WordPress can be updated, several plugins can be updated, and the
/uploads/ folder can be updated too - I don't care actually. I just think about code and that's all.
In some cases I want the database to be version controlled too. In that case I export all the database tables into a
.zip file and put it inside the theme into a
_db_ folder and then add and commit.
Within my Plugin (i.e.
my-plugin is the folder name), I follow the similar steps to control versions of my plugin.
For whole WordPress Project
To control versions of the whole WordPress project, get into the project folder and initiate git there to catch all the changes to the project.
project\ .git\ wp-admin\ wp-content\ wp-includes\ ...
That's all what came to my mind.
hello fellow cowboy coder, I have been dabbling away with wp and git for some time. I have some projects stored on GIT, but they are there purely in a collaborative format. WP have there own repository for wp themes. Git is fairly straight forward to set up, there is a GUI for GIT, but its much more efficient to use the command line approches. GIT only gets messy when you are working with large teams updating into a project, since your the only Developer, you would be mainly doing git push's and only need to pull when your deploying the files.