履歴もまっさらに最初からInitial Commitした状態にする方法。
Windowsコマンドラインでおこなった(TortoiseSVNが使えている環境)←ざっくり杉
適当な新規ディレクトリを作成から始める。
C:\Temp>mkdir gh
C:\Temp>cd gh
C:\Temp\gh>git clone https://github.com/hoge/hoge
C:\Temp\gh>git clone https://github.com/hoge/hoge
Cloning into 'hoge'...
remote: Counting objects: 225, done.
remote: Compressing objects: 100% (17/17), done.
rRemote: Total 225 (delta 9), reused 1 (delta 1), pack-reused 207eceiving object
s: 84% (189/225), 1.17 MiB | 1.04 MiB/s
Receiving objects: 100% (225/225), 1.99 MiB | 1.04 MiB/s, done.
Resolving deltas: 100% (55/55), done.
Checking connectivity... done.
C:\Temp\gh>dir
ドライブ C のボリューム ラベルは OS です
ボリューム シリアル番号は xxxx-xxxx です
C:\Temp\gh のディレクトリ
2015/05/15 10:07 <DIR> .
2015/05/15 10:07 <DIR> ..
2015/05/15 10:07 <DIR> hoge
0 個のファイル 0 バイト
3 個のディレクトリ 783,117,897,728 バイトの空き領域
~ここで、展開されたファイルをいじり倒す(削除や変更や追加も)~
C:\Temp\gh\hoge> rd /s/q .git ※GITリポジトリを消す(履歴も消える)
C:\Temp\gh\hoge> git init .
必要ならここで C:\Temp\gh\hoge\.git\config を編集し、以下を追加
[user]
name = oreore_name
email = oreore@mail.com
signingkey = ""
C:\Temp\gh\hoge>git add *
C:\Temp\gh\hoge>git commit -m "Initial commit"
C:\Temp\gh\hoge>git remote add origin https://github.com/hoge/hoge
C:\Temp\gh\hoge>git push origin --force
(↑2行は以下でも可)
C:\Temp\gh\hoge>git push https://github.com/hoge/hoge master --force
Username for 'https://github.com': oreore@mail.com
Password for 'https://oreore@mail.com@github.com':
Counting objects: 146, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (141/141), done.
Writing objects: 100% (146/146), 1.42 MiB | 280.00 KiB/s, done.
Total 146 (delta 17), reused 0 (delta 0)
To https://github.com/hoge/hoge
+ 16fde7d...bebf7d2 master -> master (forced update)
Githubのユーザ名とパスワードが聞かれて入力して完了
※他のブランチでの履歴をリセットしたい場合、以下で切替て、もう一度、git pushする.