git 檔案打包命令

海諾發表於2014-12-25

最近在使用版本庫軟體git的時候出現了問題,因為先是用coding的打包,但是coding打包不徹底,後來使用sourcetree來打包,還不錯,但是換到linux下後 使用了命令列,怎麼用命令列打包呢?
百度搜尋後發現以下命令不錯

git archive

我的蹩腳英文就不獻醜了大家到這個地方 http://git-scm.com/docs/git-archive 去看吧

簡單的用法就是

git archive --format zip --output /path/to/file.zip master # 將 master 以zip格式打包到指定檔案

還有個更簡單的

git archive v0.1 | gzip > site.tgz
git archive master > /home/hainuo/fds.zip

還有一個增量的

git archive develop $( git diff v1.1.8_beta13..v1.1.8_beta14  --name-only)|gzip >aaa.zip #比較兩個版本之間的差異檔案,生成一個差異檔案壓縮包

部分程式碼來源 http://www.w3php.com/archives/45

關於git打包時出現亂碼的問題見問答
http://segmentfault.com/q/1010000002443403

相關文章