什麼那些三線做的是上傳您對自己Octopress博客(該哲基爾項目)到您的GitHub庫的source
分支的源所做的所有修改(注意,這將包括在一切根目錄,而不僅僅是無關source
文件夾中找到的幾個文件)。
在另一方面,什麼rake deploy
確實是產生了博客,並上傳只有結果(所有靜態的HTML頁面)給您的GitHub庫的gh-pages
分支(這個結果從_public
目錄中取)。
從技術上說,你不有上傳源GitHub的,但是,它是在情況下,你的硬盤出現故障,或因任何原因,你的信息會消失有很大的幫助,你必須從頭重建源(我很確定沒有腳本需要HTML頁面並將其反編譯爲_layouts
,_includes
,_posts
和樣式)。
因爲我通常是在相同的時間結果上傳源,我創建了一個bash腳本在此協助(如你所說,它需要爲它的所有運行一分鐘,但我只是step aside and do something else in the meantime):
#!/bin/bash
# Load RVM into a shell session *as a function*
# NOTE: Not necessary if you already have a line similar to this in '~/.bash_profile'
[[ -s "/home/andreas/.rvm/scripts/rvm" ]] && source "/home/andreas/.rvm/scripts/rvm"
# Create static site
rake generate
# Publish site to GitHub
rake deploy
# Fetch the optional commit message (as an argument)
if [[ -z "$1" ]]; then
message="Updated source `date`"
else
message="$1";
fi
# Push the changes to 'source' to GitHub
echo ""
echo "## Commit source to GitHub"
git add .
git commit -a -m "$message"
git push origin source
要使用它,將它保存爲像deploy.sh
,並執行它。這需要一個可選參數,你可以指定一個提交信息:
$ deploy.sh "Add blog post 'Why Pandas are going to kill us all'"
如果沒有承諾提供的消息,它會自動創建沿Updated source Thu May 8 23:50:14 CDT 2014
行提交信息。
我已閱讀所有文章,但我遇到了與以前相同的問題:我的octopress文件夾中的所有文件都被複制到github,而不僅僅是源文件或_deploy文件夾。如果我確實爲項目做貢獻,我不能運行任何rake命令。 – thxou 2013-03-16 16:52:22
最後我明白了,如果我想上傳我的代碼,我必須每次都執行'rake deploy'。感謝這篇文章,它幫了我很多。 – thxou 2013-03-29 13:22:47