Credit: Clone Your Octopress to Blog From Two Places
每个octopress建立的静态站点的结构是(假定octopress目录为 $octopress):
- $octopress 是 username.github.com的
source分支 - $octopress/_deploy 是 username.github.com的
master分支
$ git clone -b source git@github.com:username/username.github.com.git octopress
cd octopress
git clone git@github.com:username/username.github.com.git _deploy - install octopress environment
gem install bundler
rbenv rehash # If you use rbenv, rehash to be able to run the bundle command
bundle install
rake setup_github_pages当你在一处更改了username.github.com的源代码,若想在其他地方继续更改则需要将修改push到source分支,然后在另一处pull出来继续修改。
在A处编写了新的blog
rake generate
git add .
git commit -am "Some comment here."
git push origin source # update the remote source branch
rake deploy # update the remote master branch在B处继续修改前
cd octopress
git pull origin source # update the local source branch
cd ./_deploy
git pull origin master # update the local master branch