Skip to content

Instantly share code, notes, and snippets.

@kouichi-c-nakamura
Created January 7, 2026 23:38
Show Gist options
  • Select an option

  • Save kouichi-c-nakamura/3c8a73cff25df27bfd5cacc7db86ca16 to your computer and use it in GitHub Desktop.

Select an option

Save kouichi-c-nakamura/3c8a73cff25df27bfd5cacc7db86ca16 to your computer and use it in GitHub Desktop.
学習用に履歴を捨ててrepoのprivateコピーを作る
# 1. 元のリポジトリを普通にクローン
git clone https://github.com/author/original-repo.git
# 2. フォルダに入る
cd original-repo
# 3. 過去の履歴(.gitフォルダ)を完全に削除(これでただのファイルの束になる)
rm -rf .git # Windowsなら rmdir /s /q .git
# 4. 新しいGitリポジトリとして初期化
git init
git branch -M main
# 5. 全ファイルを登録してコミット(これがあなたの「最初のコミット」になる)
git add .
git commit -m "Initial commit for study"
# 6. さっき作った自分のPrivateリポジトリを宛先に設定
git remote add origin https://github.com/YourName/my-study-repo.git
# 7. アップロード
git push -u origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment