什麼該放進版本管理系統 以及 理想目錄架構說明

P.S. 這裡的理想目錄架構完全是以 bPack 這個我自已在用的套件組來說

最近在某些原因為驅動下,我開始用起了版本管理這個神奇而重要的工具

一開始,我常把整個 Working directory 都給 add 進去

結果到最後變得很容易 clone 到別台主機上時,就把其他主機的設定給蓋掉了

於是我整理出了一個表來提醒自已什麼該放什麼不該,寫在這裡希望大家如果有不同的想法

也請大家再和我說 ^_^

原則:有共通性的才能放在版本管理裡(這樣有好處,可利用 git hook 讓它在 commit 後馬上把相關的檔案 checkout 至 work testing server 而不會讓 work testing server 掛點)

(以下都是用 bPack 目錄架構)

什麼該放進去 Source Control?

  • M (model/)
  • V (tpl/ , public/js/, public/css/)
  • C (do/)
  • 開發中會用到的工具
    • dev/tests/ (相關的單元測試)
    • dev/docs/ (文件 for 程式設計師參考)
    • dev/env/developement (環境設定(.htaccess, config.php),上線後要刪掉)
    • dev/env/production (環境設定 , 上線後要刪掉)
    • dev/db_schema/latest/ (這裡放最新的 schema) 如果有變動要放進來
    • dev/db_schema/20100115/ 這裡放這一天修改的 ALTER 讓不同的開發者可以用這個升級他們自已的資料表到最新的進度
    • dev/editor/ 放一些編輯器的習慣(像我的習慣 Komodo Edit 專案檔我就會放這裡)
  • 設定 (config/constant.php, config/base.config.php, config/admin_menu.php 這種不管在哪裡個環境都適用的資料)

什麼不該放在版本管理?

  • 圖片
  • 暫存檔
  • 外部 Library 如 smarty, phpmailer 這種 (這個應該是要在 bulid system 下自動抓新的放進來)
  • 在不同主機上會有需要更動的設定(這裡指的是放在原位置,應放至 dev/env/ 下)
This entry was posted in 資訊相關 and tagged , , , , , , , . Bookmark the permalink.

2 Responses to 什麼該放進版本管理系統 以及 理想目錄架構說明

  1. jaceju says:

    很棒的解說~ 感謝~

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>