Skip to content

Instantly share code, notes, and snippets.

@ubnt-intrepid
Created July 27, 2015 13:03
Show Gist options
  • Select an option

  • Save ubnt-intrepid/dc683e978524808d977a to your computer and use it in GitHub Desktop.

Select an option

Save ubnt-intrepid/dc683e978524808d977a to your computer and use it in GitHub Desktop.
Gitのログの中から特定の拡張子のファイル名を抽出する

git filter-branch で履歴を一括削除したい場合に用いる

拡張子指定

$ git log --name-only 2> /dev/null | grep '.\(sdf\|suo\)$' | sort | uniq
hoge/huga/test.sdf
hoge/huga/test.v12.suo
...

ディレクトリ名指定

$ git log --name-only 2> /dev/null | grep '/\(Win32\|x64\|Debug\|Release\)/' | sort | uniq
マッチングしたディレクトリ配下のすべてのファイルが列挙される
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment