Add a folder from outside the repository to repo? - wordpress

I'm working on a WordPress theme, and I've just created a repository from the theme folder inside /wp-content/themes/ directory. But now I've moved some code from the functions.php file to two plugins in the /wp-content/plugins/ directory.
Question, can I add the plugins folder to my exiting repository?

You can store them directly in your repo and create symlinks to them in /wp-content/plugins. This is a popular method, many people use it to manage their dotfiles with git.

Related

WORDPRESS - How to manage code repository with GIT

In wordpress development, we have to deal with upgrade version of plugins and I don't know how to manage code repository with them. actually, we have 3 folders like wp-content, wp-admin, wp-includes, ...
Should I push all of the code which belong to wordpress folder into the GIT repository? Then the new version of plugin will affect to changes of files.
How do I manage the changing of files as less as it can? Should I use .gitignore for it?
Updated: I found the solution at here with the examples. Check this link out
.It is really cool
WordPress can be a joy for running in a GIT repository, this is how I handle it.
I gitignore wp-config.php because that is usually different between local, staging and live sites.
I also gitignore the uploads folder because binary files in git suck and your repo will grow brutally fast. Plus it makes it a pain in the butt to do local development while the site is live.
There are some cool solutions out there, search for Bedrock by Roots for doing interesting deploys, but honestly the simplest way is just to make a repo of the entire install minus the uploads and wp-config.php.
Manually create the wp-config.php on the server.
Use rsync to manage the uploads or you could use FTP if you're not keen on the terminal.
This is the .gitignore file that I use for my projects.
/.idea/
*.log
/wp-includes/
/wp-admin/
/wp-content/advanced-cache.php
/wp-content/backup-db/
/wp-content/backups/
/wp-content/cache/
/wp-content/languages/
/wp-content/plugins/
/wp-content/upgrade/
/wp-content/uploads/
/wp-content/wflogs/
/wp-content/wp-cache-config.php
/.htaccess
/license.txt
/readme.html
I only work with private repositories so I don't have to exclude the wp-config.php.

Git - Track a folder from a separate repository and have a separate repository set up inside of it

I have the following folder structure running on an NGINX server.
-- Laravel installation
-- Magento installation [DOCUMENT ROOT]
-- Laravel's public folder renamed to a different name
-- WordPress installation
The website structure goes something like:
www.example.com = Magento
www.example.com/subsite = Laravel [This is its 'public' folder.
Rest of the folders are placed in a separate folder]
www.example.com/subsite/blogsite = WordPress [Running inside of Laravel]
I had to do the Laravel folder separation because I wanted to make it work as a subdirectory but somehow couldn't figure out how to do it. So I instead followed the Method #1 in this post.
The challenge now is to manage these 3 repositories separately.
I have two major concerns:
How do I track the stranded Laravel public folder which is now inside the Magento repository?
How can I manage the WordPress installation as another separate repository?
1. How do I track the stranded Laravel public folder which is now inside the Magento repository?
As per this answer, you can add external directories to your working tree with this git command:
git --work-tree=/ add /home/some/directory
2. How can I manage the WordPress installation as another separate repository?
You can use .gitignore to ignore the subfolder in the Magento subfolder.
In the Magento root, create a file named .gitignore
In this file, create a list of folders/files you want to ignore, in your case you want to ignore the Wordpress folder within the Laravel directory (assuming it's under public/wordpress.
/public/wordpress/
/public/wordpress/*
Do a git commit: git commit -am 'Ignore the Wordpress folder'
Now you can just create a seperate git tracking instance on the Wordpress folder.

Git Ignore sub directory for WordPress theme

I am trying to setup GitIgnore to work with Git Tower (www.git-tower.com) and WordPress.
I want to have the repository in the root directory with the option to include just specific themes and plugins.
I will start with including just one theme sub directory.
Tower is not showing me the single theme directory. Instead it shows all of the wp-content folder. I expect this to be ignored as I have specified this in the ignore file.
So.. root: /
Directory to include: /wp-content/themes/raison-winetrust/
I tried the following:
/*
!.gitignore
!/wp-content/
/wp-content/*
!/wp-content/themes
/wp-content/themes/*
!/wp-content/themes/raison-winetrust/
Screenshot: https://www.dropbox.com/s/9lajg1h89n2jwkr/Screenshot%202015-01-23%2013.53.48.png?dl=0
Any advice appreciated.
Thanks
If you are only tracking that theme (not any of the other wordpress gubbins) why not initialise the git repo in the theme folder?
The other option is that you just do a git add of that folder and only add that folder when there are changes.

Ignore containing folder, but not a folder within

I'm cleaning up my development workflow and I was wondering if it is at all possible for Git to ignore a containing folder, but allow folders within?
Allow me to clarify.
I'm currently working on my website and I'm theming my new Wordpress blog - Obviously I have a local installation of Wordpress and a remote installation. I want to be able to ignore the main folders and only allow the themes folder. The structure is as follows.
Blog
wp-content
wp-includes
themes
modules
[...]
I want to ignore absolutely everything except the themes and modules folder - how would I do this in my .gitignore?
How about this:
# Ignore everything in the top-most directory
/*
# Except the wp-includes directory
!wp-includes/
# Exclude everything in the wp-includes directory
wp-includes/*
# Except the folders themes and modules
!wp-includes/themes/
!wp-includes/modules/

How to clone WordPress theme from github

I've been developing a wordpress theme on a dev site, and all along I've been pushing it to github. It's now ready to be deployed to my live site, but I'm not sure how to do that.
What I've tried so far (that didn't work) is creating an empty /wp-content/themes/my-theme/ directory on my live site, and I cd into it. Then I use git clone git#github.com:path/to/my-theme.git but that creates another directory inside of my my-theme/ directory with all of the theme files inside of it. To clarify, that now creates:
/wp-content/themes/my-theme/my-theme/[all theme files here]
But I just want the files from the github repo to be placed directly into the original empty my-theme directory that I created.
try git clone <repo> . -- you can specify the directory as the last argument.

Resources