2009年7月23日 星期四

Pack your source codes by git archive (使用 git archive 打包程式碼)

程式碼若有使用 git 管理,要打包散佈出去的使用,可以使用 archive 來做。

[查出要打包的 tree-ish]
> git reflog
af8283a... HEAD@{0}: commit: First release!
61e0cf6... HEAD@{1}: pull : Fast forward
d5e17c4... HEAD@{2}: commit: Modify files ...
f20638e... HEAD@{3}: pull : Fast forward

[執行 git archive 指令]
> git archive --prefix myCode/ af8283a | gzip > myCode.tar.gz

[注意 umask 的問題]
umask 會影響打包的程式碼解開後的檔案或目錄權限問題。可調整 git config 中的 tar.umask 設定

沒有留言: