gitリポジトリに間違って追加してしまったファイル等を完全に消去する方法を紹介します。

   1  % git filter-branch -f --index-filter 'git update-index --remove "filename"' HEAD
   2  % git push --force

ディレクトリを削除したい場合は、ディレクトリの中身のファイルを1つずつ全て削除します。

ポイント

  • 上記のコマンドはワーキングディレクトリのROOTで実行する必要があります。
  • "filename"はワーキングディレクトリのROOTからの相対パスで記述します。
  • "-f" オプションはつけておいた方が良いです。
posted by Png genki on Sun 30 Aug 2009 at 08:47
Contents
gitリポジトリからファイルを完全に消去する方法
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ