How to set up git for wordpress theme development - wordpress

I am setting up 10 new local wordpress sites. I have 10 folders all named like this:
"name-of-site.com"
Inside each is a simple file structure:
briefing files
html
wordpress
I want to set up a repository on git hub for the wp-content file but I can't find a way to create an alias. Surely the end result will be 10 different repos all called "wp-content"
How can I set up a separate repo for each wp-content folder and name it "name-of-site.com"
Is this glaringly obvious and I am being really stupid???

Why not have the top level folted, that is "name_of_site.com" be the repository, and in that folder, you can create a .gitignore file to ignore the other directories you don't want, that is, the html and briefing files (if I understand your layout correctly). That way, you're simply tracking the Wordpress content. You can even move it up a level so that only the briefing files and the HTML are in separate directories and the WP content is in the "name_of_site.com" directory.
Edit:
After your comments, I think you could do it this way:
Create repos for each site you have and put the wp-content of those sites in the .gitignore file
Create one repo for wp-content, which contains all your themes. Organize them according to your needs.
Write a simple shell script that pulls the latest theme into your site's folder from the repo in the previous step. That way, every time you update your theme, you can go to your chosen site and just synch up with the latest pushed version.
Does that make sense?

Related

WPengine and git

For some weird reason when I push to wpengine, my files get updated without a problem -- but it will not delete files only within my the theme folder.
Here is a list of what's going on:
I have no trouble deleting the theme file, the theme will be removed. However if the theme is added back, the removed files within the folder are still present
When I pull the git repo the files are correct
Any file removed within the theme's directory is not updated
I reverted the environment back to the production (by overwriting the env with production's db and files), when I pushed my code everything was correct.
I have NO idea how to fix this. Please help!
suwebdev/wpengine mentions:
Custom components of this site are created as themes and plugins.
These are stored in separate repositories and brought into the production code using Git submodules.
Double check if you see a .gitmodules in your main repo, which refers to your themes folder you are trying to update.
That would explain why a local change (within the theme folder, which is actually its own Git repository, as a submodule) is not reflected to your deployment process.

Where to download Git in your local Wordpress directory?

Where would I download Git on my Local Wordpress Environment So then I can create a branch and use it as a type of test environment. and have access to the other themes?
If you are looking to test plugins and themes, it's most likely that your working directory should be established in /wp-content - it contains both /plugins and /themes. You'll want to make sure you have a .gitignore file that only tracks what you're working on.
If you are looking to work on changes to core, your working directory will almost always be the top-most WordPress root. That way, you can track WordPress/WordPress.
Actually I put my GitHub folder in my themes folder and then I could use the repos in my GitHub folder on my local host WordPress site

Wordpress installation infected

my problem is, that my wordpress installation was infected. So I downloaded the whole files and checked them by V-scan. It seems to be okay, but google-pages find an deeper problem.
here you can see the page: best-around.de
Now I want change all files via ftp. (no new installation) ... I extracted the new version of wordpress.
And now my question is, which data i need from the old installation (like wp-config.php). So that I can changes only the files.
Thanks and kind regards
Armin
It really depends on what you are trying to keep.
wp-config.php stores your database connection details and a few other settings.
wp-content is the directory that stores all of your uploads and plugins. Essentially all of your uploaded content.
The file and folder shown above are what you would typically want to keep. However, the infection could very well have spread to the php files in there too - so keep that mind!
The alternative method is listed below:
A good idea would be to follow the manual upgrade process instead
Get the latest WordPress zip (or tar.gz) file.
Unpack the zip file that you downloaded.
Deactivate plugins.
Delete the old wp-includes and wp-admin directories on your web host (through your FTP or shell access).
Using FTP or your shell access, upload the new wp-includes and wp-admin directories to your web host, in place of the previously deleted directories.
Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files).
Upload all new loose files from the root directory of the new version to your existing wordpress root directory.
If you get stuck here - have a look at https://codex.wordpress.org/Upgrading_WordPress_Extended

Where to save plugins for openshift wordpress install

I would like to upload a custom installation of openshift. I have installed wordpress and cloned it via git. Now I would like to add manually some plugins and push it back to openshift. Where do I have to put in my extracted plugins/themes?
I appreciate your answers!
Short answer: store your plugins and themes in .openshift.
Longer answer:
Every Openshift account has what can be thought of as a username - a long number like this:
53f1a90f500446c42053423083
Each directory structure features this number so yours:
/var/lib/openshift/53f1a90f500446c42053423083/app-root/runtime/repo/.openshift
will be different to mine:
/var/lib/openshift/12345678901234567890123456/app-root/runtime/repo/.openshift
The number gets incorporated into environment variables so that scripts will work on yours and mine equally. One of these is OPENSHIFT_REPO_DIR. On your install it will point to:
/var/lib/openshift/53f1a90f500446c42053423083/app-root/runtime/repo
on mine:
/var/lib/openshift/12345678901234567890123456/app-root/runtime/repo
Another is OPENSHIFT_DATA_DIR.
When you push changes from your local directory via git, the deploy script is run and it assembles all the wp files it needs into a directory it names:
OPENSHIFT_DATA_DIR/current
Openshift moves the 'original' wp plugins and themes folders that are created during a wp install into the OPENSHIFT_DATA_DIR/current/wp-content. It looks in OPENSHIFT_REPO_DIR/.openshift for your code and copies in any plugins and themes folders it finds there.
Net effect is to assemble the plugins and themes directories by adding yours to those that came with wp. So, your fully-assembled OPENSHIFT_DATA_DIR/current will have these in it:
OPENSHIFT_DATA_DIR/current/wp-content
/themes
/plugins
/uploads
So, anything you put in .openshift will be copied to the right place, but not altered.https://github.com/openshift/wordpress-example

WordPress updates overwrite .svn folder

We're using Subversion to keep track of the changes our web team makes to our Wordpress site. We do nothing more than modify and update our custom theme, but we have difficulty updating the Wordpress core and plugins.
Right now, I have my checked out copy working on a local WordPress install. However, when I run the automatic WordPress updates on this local copy, the updates overwrite the .svn folders in the respective subfolders, resulting in a "Directory .svn containing working copy admin area is missing" error when I try to commit the update.
How can I do these updates automatically without overwriting the .svn folder? As of now I am resorting to copying the files in manually.
If you're just maintaining your theme, you should not have the whole wordpess install under svn but just the theme. I also think in your case it doesn't make sense to actually use a working copy of your repository in the actual live site. In your case I'd keep a working copy of your theme somewhere on your server and then rsync on demand to your theme folder. This way you can update wordpress and your plugins automatically and without problems.

Resources