Search code examples
gitmovebitbucketrepository

How do I move a local git repo from parent folder to subfolder?


I recently set up a git repo and I want to change its local directory.

Its current directory is:

Users/...Documents/Git

I want to change this so that there are several repos within this folder:

Users/...Documents/Git/project1
Users/...Documents/Git/project2
etc.

I want to move everything that's currently inside the parent folder into $project1.

I have already set up separate repos on bit bucket and I tried to link the subfolder with the bitbucket repo. But I think I messed it up, and I think I may now have the same repo connected to two local folders. I'm not sure of how to check or correct this.


Solution

  • You can just move the entire directory. Just make sure that every subdirectory gets moved too. Git doesn't care, it just needs the .git subdirectory.