Git Ignore sub directory for WordPress theme - wordpress

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.

Related

Add a folder from outside the repository to repo?

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.

Separating Wordpress theme from system files in a git repository

I've been making a Wordpress theme and using git to save progress. My whole Wordpress site is in the git project, and I would like to remove everything except the theme folder so I can easily transplant it on other Wordpress sites.
I know one way is to just delete everything and move the theme to the root folder and commit. But checking out after that will be more complicated, right? So is there another way?
Thanks.
If you are interested in keeping the full history of your Theme folder, you can use git filter-branch and remove everything else.
See "Extract part of a git repository?" ,to be done in a clone of your current repo:
git filter-branch --subdirectory-filter Project/SubProject-0 --prune-empty -- --all

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/

Unable to upload new theme to wordpress from dashboard

I installed wp to a server for the first time. The basic theme works and I can change the settings but I bought a new wordpress theme and was trying to upload it from the dashboard:
But it gives me an error each time:
These were suggestions I found online but didn't work:
So I tried to change the permissions of all of the folders to 755. And then I changed the permissions of the file update.php to 755 also but I still get the same error. I also tried editing the .htaccess of the folder 'AALimo' (folder which contains the wp dir) but that didn't work either. I'm not sure if I edited the .htaccess properly.
I just manually uploaded the theme into the theme directory using ftp instead of the theme uploader from dashboard and that worked.
I did it using C-Panel. I had to upload zip file in WordPress theme folder in public html. extract the zip file and you can install it easily .

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