Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Change path of the repo - move into a subfolder

dghez November 20, 2017

Hi everyone!
I made a mistake creating a repo in a wrong folder.
I created a wordpress project and I decided to create a repo of my custom theme but after some days of work (shame on me) I realised that the path of the repo is the entire project, including the wp-core files / wp-admin files. 
Now I'd like to move the repo parent folder / container to a subfolder of the current one.
Is there an easy way to do that?
That's my tree of the repo

  • WP entire folder (current path of the repo)
    • WP admin
    • WP includes
    • WP content (here I want the repo)
      • themes
      • plugins
      • etc...
    • etc... 

Hope everything is clear.
Can anyone have some ideas how to do that?
Thanks to everyone!

I'm using Sourcetree last version.

1 answer

2 votes
minnsey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 21, 2017

I think it all depends on whether you have committed changes into your repo for the current structure and whether you need to be keep that history?

Since the name of the local folder containing the repository is not a key bit of information (i.e. it just holds the .git folder and the working copy) you should just be able to copy all of your files and folders up one level, leaving the .git folder in place.... if that makes sense.

e.g. from 

  • Parent folder
    • WP entire folder (current path of the repo)
      • .git
      • WP admin
      • WP includes
      • WP content (here I want the repo)
        • themes
        • plugins
        • etc...
      • etc...

up to 

  • Parent/WP entire folder 
    • WP admin
    • WP includes
    • WP content 
      • .git
      • themes
      • plugins 
    • etc... 

when you come to commit the repo you will find all of the higher files/folders 'deleted' and the ones you want moved up a level

dghez November 21, 2017

So essentially you just advice to move the git-related file (folder + hidden files) into the folder I want. Then it makes a check with the new folder and it will find that some files are missed and it will interpretate as deleted. 
For me I think is fine because I made changes only into the WP content folder and I'm still on the master brach so I don't think there will be problems.

Thanks for the reply,  I'll try asap.

minnsey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 22, 2017

I suspect the end result will actually be the same, but personally, I would actually have cloned the repo into a new clean folder with an extra parent level and then moved everything apart for the .git folder one folder higher.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events