开发者

Creating git development directory

开发者 https://www.devze.com 2023-02-07 20:34 出处:网络
I\'ve just installed git on my production server and added all my production code under /httpdocs/ to my git repository and committed it.

I've just installed git on my production server and added all my production code under /httpdocs/ to my git repository and committed it.

I've now setup my development webserver to use /httpdocs/dev/ as its HTML root directory and want to use /dev/ as my staging and dev directory.

开发者_如何学C

How do I use git to create a branch on /httpdocs/dev/ such that I can make changes, commit it, and then checkout to my /httpdocs/ folder?

Thanks, Git Newbie


You can read more on this webpage for more details but basically you can create a bare repo on your server with git init --bare then add a post-receive hook to the bare repo with the following.

#!/bin/sh
GIT_WORK_TREE=/httpdocs git checkout -f


"cd /httpdocs/dev", followed by a "git init". Done.

Please read the documentation, they are there to explain how to do these very simple tasks.

0

精彩评论

暂无评论...
验证码 换一张
取 消