BluGeni
BluGeni

Reputation: 3454

Setup git locally on filesystem

I am stuggling to understand how to set this up correctly. I want to be able to have a test site and a production site and use git to manage it.

my current file system looks like this (production is in the www folder and test is within the www in a folder called test

-www
  -test
    index.html
index.html

Right now I have it setup so i can make changes on test and commit them with git but I dont know how to push or pull them into www/

Upvotes: 0

Views: 67

Answers (1)

janos
janos

Reputation: 124646

Nesting test under your production site sounds bad. It would be better to organize this way:

site/
├── repo.git
├── test
└── www

Here, repo.git is a bare git repository, and you could have it as the remote of both www and test. Then you could push and pull from whichever.

You could convert your existing setup with these commands:

cd test
git clone --bare . ../repo.git
git remote add origin ../repo.git
cd ..
mv www www.bak
git clone repo.git www

In this setup, you could push in test, and then you could pull in www.

Upvotes: 2

Related Questions