Search code examples
gitversion-controlgithublocalhost

Can I combine my local Github repository with WAMP localhost folder?


I have C:\Users\my\Documents\GitHub for my local GitHub repository, and C:\wamp\www is where I work on projects locally with Wampserver.

What is the appropriate setup to work with them both? Should I tell Git to use 'www' as my local repository? Will that combine localhost with Github??


Solution

  • You could simply use the --work-tree or --git-dir argument of git in order to:

    • be in the Github folder, but mention that the working tree is www

      cd C:\Users\my\Documents\GitHub
      git --work-tree=C:\wamp\www status
      
    • or be in the www folder and mention that the git repo is in the Github one

      cd C:\wamp\www status
      git --git-dir=C:\Users\my\Documents\GitHub\.git
      

    The other approach is to have a git repo in both, and pulling Github from www.

        cd C:\wamp\www status
        git add remote origin C:\Users\my\Documents\GitHub
        git pull origin master