Git checkout for submodules not working for WordPress - wordpress

I have WordPress as a git submodule and it is checked out at tag 3.8.1.
I want to get the latest version of WordPress which is 3.8.2.
I have done the following structure:
/html
/wp - submodule to WordPress
I then run the following commands:
$ cd wp
$ git checkout 3.8.2
Previous HEAD position was 22bb602... Tag 3.8.1
HEAD is now at 5577e02... Tag 3.8.2
However when I go and check the WordPress dashboard it still tells me that I still need to update to 3.8.2.

3.8.2 is actually a tag, not a branch. It points to a specific commit. Pulling makes no sense there.
If you want to stay up-to-date with the 3.8 version use the branch 3.8-branch.
$ git checkout 3.8-branch
$ git pull

This was a complete red herring. The git checkout 3.8.2 was working. But I hadn't properly checked the file changes and there's no such indication that the files have been updated as when you do a git pull.
However the WordPress dashboard was thinking that I was not on the latest version because I am using a dutch translated version of WordPress.
So in the wp-config.php I have define( 'WPLANG', 'nl_NL' );
This then requires that you are using the nl-NL installation of WordPress from e.g. https://downloads.wordpress.org/release/nl_NL/wordpress-3.8.2.zip
However because I am using the github version of WordPress, that only has the US English version of WordPress. Its a hack, but to fix the problem I just edited the wp-includes/version.php file, to include the following line at the bottom, which is the only file that differs in the WordPress core for the translated version:
$wp_local_package = 'nl_NL';
Then WordPress is happy that you have the latest version.
Then you have to pull in the translation files.

Related

Setting up git on wordpress: Issue with git add

I have been trying to setup git on a WordPress site, The issue seems to be that while I run git add --all.
The files get deleted for some reason. Not sure what seems to be the issue.

Update Wordpress when using Github Wordpress skeleton

This is mainly a clarification about dealing with public Repos for git beginners.
I have a local git repo with a clone of Wordpress skeleton (https://github.com/markjaquith/WordPress-Skeleton). This includes Wordpress as a submodule (https://github.com/WordPress/WordPress).
If I update Wordpress from the dashboard it will require me to update my git repo.
There is a note about making a pull request if the repo falls behind but I am working on my localhost so can't do that.
If I had a hosted repo, should I send a pull request to the WP skeleton or WP repo?
I have a fresh install at the moment but if I were to customise it I probably wont want to (or Shouldn't) push so what would I do in this case?
Note: This is using the Wordpress repo as an example but I am curious about the best/general practice.
I'm having some similar questions, mainly about what the best practice is when updating Wordpress. Should I use the Dashboard once on remote, or should I continue to update the Wordpress Submodule in WP-Skeleton.
I can tell you this, you can update Wordpress via the Submodule in WP-Skeleton by using the "Git Checkout" command on the submodule and choosing the latest release number (4.1 as of this writing). Its extremely simple in SourceTree if you're new to Git and need an interface to help.
This is a little late but I asked the author of the repo and he answered me in his QA repo on Github.
This is the answer Mark Jaquith gave there which worked:
For your personal sites, which have likely wildly diverged, the update
process is as follows:
cd wp
git fetch
git fetch --tags
git checkout 3.9.1
cd ../
git add wp
git commit -m 'Update to WordPress 3.9.1'
git push origin master
Let me break that down:
cd wp — move into the WordPress submodule directory.
git fetch — Pull down the latest changes from tracked branches.
git fetch --tags — Pull down the new tags. You do steps 2 and 3 in this order because otherwise you might have a tag that points to a commit that you don't yet have in your repo.
git checkout 3.9.1 — Checkout the 3.9.1 tag.
cd ../ — Move back into the main directory. At this point, the wp subdirectory will show as having changes, since it points to a different commit.
git add wp — Tell your main repo to stage the WordPress submodule repointing.
git commit -m 'Update to WordPress 3.9.1' — Commit that change git push origin master — Push your master branch (change if using a different branch) up to your origin remote (change if using a different remote).
You probably noticed that there
is only one variable here — the version number. So You could wrap that
up into a bash script that you check into your root directory. And
then you could just do something like: ./wpupdate 3.9.1. Or you could
write a script that iterates through a bunch of WordPress site
checkouts and does this process on each of them (I've done exactly
that).
I will also add that from the wp folder you can enter git tag to see a list of tags, this way you can make sure you get the latest one.

WordPress as git submodule, accidentally updated through WP admin instead of git, now modified content

I followed David Winter's workflow to "Install and Manage WordPress with Git." WordPress is a git submodule. On the latest WordPress 3.9 upgrade, I accidentally updated through the WordPress admin instead of via git. Now when I run git status I get:
modified: wordpress (modified content, untracked content)
Which makes sense. But I can't commit the modified wordpress content. The WordPress submodule is dirty. If I run git diff within my main repo, I get this:
-Subproject commit 22bb60277036651db73dc872eaa7d2a50276b00d
+Subproject commit 22bb60277036651db73dc872eaa7d2a50276b00d-dirty
What's the best way to fix this? If I run the following within my main repo, will it mess up my WordPress install? (Note: I had also updated some plugins.)
git clean -dfx # delete everything in the worktree that isn't tracked
git reset --hard # wipe all modifications to tracked files
git checkout 3.8.1 # return to previous version tag
Update: The commands above work perfectly. I checked the documentation on git clean to learn what the options 'd', 'f', and 'x' were: https://www.kernel.org/pub/software/scm/git/docs/git-clean.html. After I ran the previous commands within the WordPress directory, I was able to then checkout version 3.9, thus correctly updating WordPress.
The following commands worked perfectly:
git clean -dfx # delete everything in the worktree that isn't tracked
git reset --hard # wipe all modifications to tracked files
git checkout 3.8.1 # return to previous version tag
I checked the documentation on git clean to learn what the options 'd', 'f', and 'x' were: https://www.kernel.org/pub/software/scm/git/docs/git-clean.html. After I ran the previous commands within the WordPress directory, I was able to then checkout version 3.9, thus correctly updating WordPress.

How do I git out of this mess with a git submodule?

I've got a git repo with Wordpress as a submodule. I was trying to update Wordpress and really screwed things up. I just want to get all of the code from the 3.7.1 tag in the remote repository, but this doesn't work;
git fetch --tags
git checkout 3.7.1
Leaves a bunch of either "untracked files" or "uncommitted changes". I don't know what I'm doing wrong. I've tried so many things to get this submodule onto the 3.7.1 tag and nothing seems to work. If anything, I feel like I'm just making the problem worse. It shouldn't be that hard to just reset the code from the tag I want and discard everything else. Any help?
Here's the git nuclear option:
git clean -dfx # delete everything in the worktree that isn't tracked
git reset --hard # wipe all modifications to tracked files
git checkout 3.7.1
which looks appropriate here.

omega 4.x sub theme creation

I have spent lots of time to search good tutorial or documentation for creation omega 4.x sub theme, But did't found. Like How to create a layout templates using with node types, taxonomy, user pages. Any help appreciable
If you are a windows user, you will first need to set up a virtual box with linux. While linux is the preferred choice to theme with Omega 4, you can also use mac but will need homebrew, etc.
Windows user:
Virtualbox https://www.virtualbox.org/wiki/Downloads
Drupalpro https://drupal.org/project/drupalpro
Drupalpro is a prebuilt linux environment for drupal. Follow the directions for install then complete the drupalpro update that is documented in the middle of the page. Make sure and update drush as per the update directions as Omega 4 needs more recent version. Last, update ubuntu with sudo apt-get update (don't use the package manager)
The directions below have been tested with Drupalpro (source for rvm install)
Install https://rvm.io/ Always check for the most recent/stable version!
$ \curl -L https://get.rvm.io | bash -s stable
$ source /home/drupalpro/.rvm/scripts/rvm
$ rvm requirements
Next build and install the latest version of Ruby (this might take awhile). As of Aug 2013, this is the latest build. Please change as needed.
$ rvm install 1.9.3
$ rvm use 1.9.3
$ rvm rubygems latest
Verify rvm install:
$ rvm -h
$ rvm list
$ ruby -v
You should get a message similar to: ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]
Now you are set up and ready to install an Omega4 subtheme. Cd to the root of your drupal site.
drush dl omega --select
Choose the appropriate Omega4 version. This will automatically download and place Omega 4.x in sites/all/themes/omega. Omega4 comes with it's own drush commands which is why it is important to have a recent version of drush. Clear drush cache then view the new omega drush commands.
drush cc drush
drush help --filter=omega
Create your subtheme
drush omega-wizard
Follow the set-up directions.
Please enter the name of the new sub-theme [Omega Subtheme]: Yoursubthemename
Please enter a machine-readable name for your new theme [yoursubthememachinename]
Please choose a base theme for your new theme
2 : Omega - A powerful HTML5 base theme framework utilizing tools like
Sass, Compass, Grunt, Bower, Ruby Version Manager, Bundler and more.
Please choose a starterkit for your new theme
1 : Default: Comes with a well organized Sass setup with heavy use of
partials. (Provided by Omega)
Please choose a destination. This is where your sub-theme will be placed
Please choose a destination type.
1 : Site (e.g. 'all' or 'example.com')
Please choose a site.
1 : all
Do you want to keep the starterkit's readme files? (y/n):
Do you want to enable your new theme? (y/n):
Do you want to make your new theme the default theme? (y/n):
If everything went as it should you will see the following message:
You have successfully created the theme Yourthemename (yourthememachinename) in sites/all/themes. [success]
After finished, inside your subtheme run:
bundle install
trouble shooting If you receive an error at bundle install or at bundle exec guard, you may need to change your terminal preferences. terminal > profile preferences > title and command > check-mark "run command as login shell" image. Close terminal, cd back to the root of your site and run bundle install.
cd into root of sub-theme:
bundle exec guard
You have now created your Omega Subtheme. Documentation for creating custom layouts here
leveluptuts are making great tuts right now for omega 4.x
leveluptuts.com
here is the playlist at Youtube : http://www.youtube.com/playlist?list=PLLnpHn493BHH5nnK2dKE_42l1oXA6Tq6H with something like a new video per week !

Resources