LoginSignup
15
8

More than 5 years have passed since last update.

BFGでコミット履歴から巨大なファイルに関する情報を消去する

Last updated at Posted at 2016-07-09

GitHubにpushするには100Mのファイルサイズ制限があります。
過去に100M以上のファイルをコミットしていた場合、(たとえ最新のコミットではgitignoreしていても)怒られます。
BFGコマンドは過去の履歴をうまく消去してくれます。
git-filter-branchのかわりになるっぽい。

例えばgit pushでこんなメッセージが出た場合

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: fce1986777f944a968512a9ef106a6a6
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.15-x86_64-darwin-14/vendor/v8/out/x64.release/libv8_base.a is 152.64 MB; this exceeds GitHub's file size limit of 100.00 MB

BFGコマンドのインストール

Macであればbrewで簡単に入ります。
$brew install bfg

BFGコマンドの実行

過去のコミットを遡って特定サイズ以上のファイルを消去してくれるコマンドです。(この場合は100M以上)
$bfg --strip-blobs-bigger-than 100M
このコマンドで最新のコミットは何も変更されません。
あとはpushするだけ

リンク

15
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
8