Skip to content

Instantly share code, notes, and snippets.

@hiyangguo
Last active March 19, 2018 15:52
Show Gist options
  • Save hiyangguo/63cee0c4680af06da51ab8db861197f1 to your computer and use it in GitHub Desktop.
Save hiyangguo/63cee0c4680af06da51ab8db861197f1 to your computer and use it in GitHub Desktop.
手动同步 gh-pages
#!/usr/bin/env bash
# 进入目录
cd dir
git checkout --orphan new
# 删除原有文件
git reset -- .
git clean -df
# 将资源文件复制到此目录
cp -a * ./
git add .
# 使用时间戳做 message
git commit -m "update in `date '+%Y-%m-%d %H:%M:%S'`"
# 删除 master 分支并重建
git branch -D master
git branch -m master
# 强制推送到远端
git push --set-upstream origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment