Skip to content

Instantly share code, notes, and snippets.

@mugyu
Last active October 24, 2020 02:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mugyu/10717929 to your computer and use it in GitHub Desktop.
Save mugyu/10717929 to your computer and use it in GitHub Desktop.
gitで空ブランチを生成する方法

空ブランチを(あるいはGitHub Pages用ブランチを)生成する方法

過去を持たないブランチ

git checkout --orphan gh-pages

親を持たない空っぽのブランチが生成される

ワーキングツリーを全削除

git clean -fdx
  • f = うっかり防止でコレがないと削除しない
  • d = ディレクトリも削除
  • x = 無視ファイルも削除

要するに、なんでもかんでも削除。(.gitは残っているはず)

git rm -rf

でもいいかも。

なんかコミットする

echo hello, world > index.html
git add index.html
git commit -m "first page commit"

リモートにpush

git push origin gh-pages

master を既に -u オプション付きでpushしていれば

git push

だけでも良さそう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment