Introduction to Version Control System for Windows
1. Version Control System
Appendix B of Introduction to C Programming
Author: Peter PH Chang
S
2. What is Version Control System?
S A.k.a. 版本控制系統
S 目的:
S 個人使用:
S 漸進式開發使用
S 怕自己改爛之後改不回去本來可以動的狀況
S 團隊開發:
S 方便大家共同看一份程式碼,有效協同開發
S 記錄是誰、在什麼時候、因為什麼原因改了那段程式碼
S Branch(分支)開發,讓支線不影響主線
3. Type of VCS
S Copy-Paste
S Centralized Version Control System
S Distributed Version Control System
4. Type of VCS
S Copy Paste
S The most easy way to implement
S Awful way
S No comment message
S Not automically
S Wasting space
S No conflict solution
S No duplicate for backup
S 不推薦使用此方法
5. VCS的流派
S Centralized VCS
S Easy to implement
S Learning curve is moderate
S Cannot develop without network
S Do everything by network. SLOW!
S There is only one server. If it is
broken, you loss everything
6. VCS的流派
S Distributed VCS
S Learning curve is steep
S Can work without network
S Everyone has its clone. Don’t worry
about server!
S Easy to branch!
7. Well-known VCS
S Centralized VCS
S CVS
S Subversion (SVN)
S Perforce
S Distributed VCS
S git
S Mercurial (Hg)
S Bazaar
9. 先來用用看
S 環境:MS Windows
S UNIX系列亦可使用,但請參考附錄文件
S 安裝
S msysgit
S Windows下git本體
S http://code.google.com/p/msysgit/downloads/list?q=net+installer
S TortoiseGit
S git的圖形化使用者介面
S http://code.google.com/p/tortoisegit/wiki/Download?tm=2
47. Another way: CLI
S 新建repo
S git init
S 新增檔案、呈交到repo
S git add .
S git commit –m “Commit message”
S 查看Git記錄
S git log
S 查看程式碼差異
S git diff 5d09
S git diff 5d09 ab01
49. GitHub
S 可自己架git server
S 在Linux、Mac上比較好架
S Windows上架git server較為複雜
S 但我們有GitHub!
S Easy to create public repo
S If you have .edu mail, you can get right to create private
repo for free during the two years
S https://github.com/edu
52. GitHub
S 複製一份下來!
S git clone REPO的網址
S 在TortoiseGit上,新增一個資料夾按右鍵,有個clone倉儲的
按鍵,按下去之後,把REPO的網址填入,即可自server複製
下來
S 和git server溝通的方式
S 自server上取得新的版本
S git pull
S 把改好的版本送上server
S git push