於是找了版本控制(Revision control)的方式, 例如說CVS, SVN和Git, 發現Git是個不錯的方式
但是目前我們還沒有辦法租用VPS而且也不想要把目前的程式變成開放原始碼(Open Source Code)
因此想到好用的Dropbox能不能架上Git server, 沒想到真的有這方面的教學文章
但是都不是應用於Eclipse上面, 正確的說, 並不是使用Eclipse的Pluging : Egit 來操作
於是我研究了一下, 把心得分享給各位!
安裝Egit
首先我們是使用 Egit 來操作, 因此必須先在Eclipse上面安裝此Pluging
1. 在Eclipse上, Help > Install New Software... 會出現以下畫面
2.按下Add.. ,增加一個Repository,
Name 為 Egit Pluging
Location為 http://download.eclipse.org/egit/updates-nightly
3. Eclipse會找到相關的egit software, 然後安裝
4. 在Help > About Eclipse 找到以下Icon, 表示你安裝成功
製作local端repo
如果你是initial project的人, 才要做這件事情; 如果是prject成員, 請跳過
使用git前, 我們需要先將目前的project建立repo (local端), 然後再上傳到remote的repo
1. 在Eclipse上的Project前按下右鍵, 選擇 Team > Share Project ... ,然後選擇Git repo
2. 選取 Use or create repository in parent folder of project, 然後選取你的project後, 按下 Create Repository
3. 你會發現你的project的icon圖示上面多了一個類似黃色仙貝餅乾的圖案
4. 建立commit, 一樣在Project前按下右鍵, 選擇 Team > Commit... (會發現多很多功能, 這部分請自行研究吧!), 打上你的message, 然後選擇Files, 按下 Commit, 就完成一次commit了
建立remote端repo (在dropbox的folder)
如果你是initial project的人, 才要做這件事情; 如果是prject成員, 請跳過
1. 在Eclipse上面選擇 File > New > Other, 然後找到 Git 下的 Git Repository
2. 設定parenet directory為你要存放的dropbox folder, 設定Name後 , 勾選 Create as bare repository, 按下Finish
push local端repo到 remote端
當project成員完成commit一次資料到local端後, 還需要push到remote端, 才能完成資料同步
1. 在目前project按右鍵選擇 Team > Remote > Push..., 在URI 上面選擇之前製作好的remote repo folder, 按下Next
2.選擇Source ref與Destination ref, 按下Add Spec, 則會在 Specifications for push 出現你所選擇的Spec, 完成後按下Finish 完成 Push動作
相關連結:
http://zh.wikipedia.org/wiki/Git
http://www.mrmu.com.tw/2011/05/06/git-using-dropbox-as-server/
Great sharing. Just need it. Thx
回覆刪除