Creating git development directory
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.
开发者_如何学CHow 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.
精彩评论