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:
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.