Julesezaar
Julesezaar

Reputation: 3396

Copy an existing website with git already in it to a new one ( for beta testing & development )

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

Answers (1)

ollpu
ollpu

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.

Worktree documentation

Upvotes: 2

Related Questions