Using Git with Multiple Local Directories – VVV localhost and repos

I keep local copies of repos in ~/repos

I also have a ~/Sites directory

Read More

When I create a new localhost WordPress site (like the one I’m currently working on) via Varying Vagrant Vagrants it ends up in a directory like ~/Sites/vagrant-local/www/my-website/htdocs/

Most of the work will be on the theme so that path ends up looking like: ~/Sites/vagrant-local/www/my-website/htdocs/wp-content/themes/my-theme

Since I have a starter theme I work from I have ~/repos/my-theme and without thinking it through I copied it into place (the location in the above paragraph) and ended up with nested git repos and credential problems (while I hear nested repos are possible, I do not want that level of complexity, I’m just starting to understand how to use git).

Forgive me if my terminology is off, using a localhost and the command line are fairly new to me.

I think what I want is a symlink. I want these 2 directories to function as if they are one directory (so that file changes propagate to both) so that my theme’s repo stays in ~/repos/my-theme but that I can use Varying Vagrant Vagrants for my localhost server so I can enjoy both a local machine and version control.

How would I set this up?

If a symlink isn’t the right solution to this problem, what is?

Should I just cp the repo to the localhost theme location and then rm -R .git?

Related posts

Leave a Reply