Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move .git repo to parent directory [duplicate]

Tags:

git

github

gitlab

I have a subdirectory named "www" that is a repo:

site |-- www/ |    |-- .git/ |    |-- index.html |-- design/ |    |-- images.jpg 

I'd like to change the repo to the parent directory so that the repo structure mirrors the original file structure as follows:

site |-- .git/ |-- www/ |    |-- index.html |-- design/ |    |-- images.jpg 

Can this be done? Are there implications with then pushing the changes up to Gitlab?

like image 306
RGilkes Avatar asked Aug 18 '15 20:08

RGilkes


People also ask

Can I copy .GIT folder to another folder?

You are good to continue exactly where you left off: your older branch, unstaged changes, etc. This will just copy the source folder to destination/source . The correct command is rsync -azv --exclude '. git' source/ destination/ , which copies contents of source folder to destination folder.


1 Answers

  1. Create a www directory in your repo.
  2. git mv the HTML files to that directory. Optionally commit this step.
  3. mv the design directory into your repo, and git add .
  4. Commit.
  5. Rename/move your whole repo.
like image 98
Roland Smith Avatar answered Oct 14 '22 03:10

Roland Smith