Location of directory using git on ubuntu
I sta开发者_运维技巧rted using github on Ubuntu. I use PHP/MySQL.
All my applications are in /var/www directory for development.
Now should I create .git directory in each application in /var/www/, such as /var/www/myapp1/.git ?
Or should I copy each application to /home/MyGit/ and create .git directory here?
How are you doing?
Please let me know. Thanks in advance.
You should use Git to store source code, which should be separate from production code. So you should have a /home/you/src/appname
directory with the source code, which is where you should initialize Git.
When you are happy with an update, check it into Git and copy it to /var/www/
.
You can do whatever your preference is.
Personally, I have all of my projects under my home folder and if I do any local testing from /var/www I use a symlink. The reason for this is because my /home directory is mounted on it's own partition and is backed up. So I can re-install Ubunut, wiping out the contents of /var/www, and simply restore my symlinks. My .git repositories are created wherever I have that project within my home directory.
Traditionally people have used git to track a single project, so creating a repository for each applications would be the way to go if you like to follow tradition. Unless your entire www folder is an application, I wouldn't make one big git repository.
精彩评论