技術書典のサンプルレポジトリのログ綺麗にする
gitのコミットログをリセット 技術書典15で頒布する本のサンプルレポジトリのコミットログを公開前にリセットするコマンドを書き残しておきます。 頒布予定の本 https://techbookfest.org/product/cD0f3gsHUgpAzGYYnc11fs 何かしらの事情でprivateのレポジトリをpublicにする際にログを綺麗にしたい時に使います。 コマンド # git configでデフォルトブランチをmainに設定する git config --global init.defaultBranch main # git configの内容確認 git config -l # remote repositoryのurlを確認する # git@github.com:{username}/{repository}.git のような形式 git remote -v # 初期コミットをremote repositoryに強制上書き rm -rf .git git init git add . git commit -a -m 'first commit' # 確認したremote repositoryのurlを指定 git remote add origin git@github.com:{username}/{repository}.git push -u origin main -f