Reputation: 3396
We have a website running for a while now with a .git folder already in it. Everything works fine.
Now I have to set up a second beta site for testing new stuff before the changes get pushed to the live site. Can I just copy the whole website folder with .git folders and everything in it? I did:
cp -r oldwebsite/ betatestingwebsite/
(Then Offcourse I have duplicated the database too and made some changes in the global settings file for the beta site.) Then I did following commands in the new betatestingwebsite/ folder to pull the 'dev' branch:
git checkout dev
git pull origin dev
git fetch
It looks like everything is running fine but I am not sure that I can leave the .git untouched. Can I break something by doing this the way I did?
I was wandering for instance that this .git folder should be unique or so?
Upvotes: 0
Views: 31
Reputation: 1873
The copied version should be just fine, but it might be a hassle to maintain. Maybe instead of copying the whole repository, just make a separate working tree, like this:
# While in oldwebsite-folder
git worktree add ../betatestingwebsite dev
Now you can maintain these two working trees at the same time (synced fetches, etc), but they will be on different branches.
Upvotes: 2