简体   繁体   中英

Using GIT with projects that have directories in multiple locations

I'm in the middle of trying to move a PHP/MySQL web app (built on CodeIgniter 2.01 framework) to a GIT repository. The problem is for added security I've implemented the best practice of separating the application part (application & system folders) and the web files (index.php, images, css, js, etc. folders). The web files are located in /var/www and the application stuff is located in /data/company/apps/myapp.

Since I would like to keep this added security, how do I migrate a project that has multiple locations like this into GIT?

I don't think the structure of your Git repository and the structure of the deployed files need to match:

  • either you add an extra step ( post-receive hook for instance) copying the files from your Git repo to the right system paths (you separate SCM -- Source Control management -- from RM -- Release Management),
  • or you link directly your two system paths to the two relevant directories within your Git repo.

I added in the comments:

if you reorganize your repo's content in order to have to directories with the relevant content, you can make two git archive for each directory, and extract them in the right places.

To which the OP crashintoty replied:

I found the solution with the following commands in post-update :

git archive --format=tar master:guts/  | \
  tar -C /data/company/apps/myapp -x 
git archive --format=tar master:skin/ | tar -C /var/www -x

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM