0

I've combed the internet... I've got this WordPress site I'm working on, and I was a little newer to WordPress (and, specifically, getting into the code nuts-and-bolts of WordPress) when I started. I now realize that I created my repo at the wrong directory level, much too high and I want it to be more in line with WordPress convention. Generally speaking, I find that that means the file structure should look like this:

root_directory/
    wp-admin/
    wp-content/
    wp-includes/
    index.php
    license.txt
    readme.html
    wp-activate.php
    wp-blog-header.php
    wp-comments-post.php
    wp-config-sample.php
    wp-cron.php
    wp-links-opml.php
    wp-load.php
    wp-login.php
    wp-mail.php
    wp-settings.php
    wp-signup.php
    wp-trackback.php
    xmlrpc.php
    .git
    .gitignore

Mine, on the other hand, looks like this:

www.website.com/
    releases/
        5.x_wordpress/
            wp-admin/
            wp-content/
            wp-includes/
            index.php
            license.txt
            readme.html
            wp-activate.php
            wp-blog-header.php
            wp-comments-post.php
            wp-config-sample.php
            wp-cron.php
            wp-links-opml.php
            wp-load.php
            wp-login.php
            wp-mail.php
            wp-settings.php
            wp-signup.php
            wp-trackback.php
            xmlrpc.php
        .git
        .gitignore

Now, I've looked at some posts like this and this and this to SOME success - but these posts all seem to be all about how to move a file to one level lower, into a new folder. I'm wondering how to do the reverse, how to pull the files underneath existing folders into a higher-level folder. In fairness, the git mv command has been helpful - I'm now just one directory away from having a single directory and all my WordPress files underneath it in a nice, tracked git repo. I figure that the following command should work:

git mv 5.x_wordpress/* .

...but I get the following error message:

fatal: not under version control, source=5.x_wordpress/wp-config.php, destination=wp-config.php

I'm at a loss. Any ideas?

tromlet
  • 41
  • 1
  • 7

2 Answers2

0

The problem is that the directory structure on your machine and the directory structure in the git repo need to be thought of separately. What you will need to do is make the directory structure in the git repo match what you will want to have in your file system. This is why you are getting the error saying that the destination is not under source control.

I hope that this helps, as I am not following you on exactly what you are wanting to move where from your description.

dmoore1181
  • 1,793
  • 1
  • 25
  • 57
0

Just because you're in a directory tracked by git, it does not mean you have to move files around using the git mv command. You can still use just mv. So, I'd do something like this:

$ cd 5.x_wordpress    # Make sure you're in the right directory
$ mv ./* ..           # move everything in this dir one dir up
$ cd ..               # you should be in the releases/ directory now
$ mv ./* ..           # move up all your files and folders, plus .git

Optionally, you can rename the directory containing .git by moving one directory above it and doing mv oldname newname.

brunoparga
  • 98
  • 1
  • 3
  • 10